Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

问题在哪 怎么WA?? 请教大牛。。。。 代码如下:

Posted by yueyue at 2006-08-16 12:05:05 on Problem 2369
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator