#include<bits/stdc++.h>
#define ll long long
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;
signed main(){
fastio;
vector<ll> tracked, homie;
ll n, x, y, sum;
while(cin>>n){
homie.assign(n+1,0);
tracked.assign(n+1,0);
sum=0;
for(x=0;x<n;x++){
cin>>homie[x];
}
for(x=0;x<n;x++){
if(tracked[x]){
continue;
}
y=homie[x];
while(y!=x){
tracked[y]=1;
y=homie[y];
}
sum++;
}
cout<<sum<<'\n';
}
}
InnoServe 專題競賽 :::success ::: :::info Member(8): 張淙瑜 陳以芯
May 25, 2025CloudFlare Pages X Github Repo
Jan 6, 2025image
Aug 13, 2024Installation: yt-dlp 下載位置-Github往下滑到 Asset 點擊 yt-dlp.exe 下載 將下載好的.exe檔放入你最最最喜歡的位置 (建議放入C:/) ffmpeg 下載位置-ffmpeg官網(?往下滑到 Release Build選擇essential , full 版本下載 下載完後將壓縮檔放在與yt-dlp.exe相同路徑的資料夾架並解壓縮
Jun 3, 2024or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up