Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
问题在哪 怎么WA?? 请教大牛。。。。 代码如下:#include<iostream> using namespace std; #define M 1000 int c[M]; int b[M]; int main() { int n,i,k=0; cin>>n; for(i=0;i<n;i++) { cin>>b[i]; c[i]=b[i]; } do { for(i=0;i<n;i++) { if((i+1)!=b[i]) break; } if(i==n) break; for(i=0;i<n;i++) { if((i+1)!=c[i]) b[i]=c[b[i]-1]; } k++; }while(1); cout<<k+1<<endl; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator