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

崩溃了

Posted by liangyifeng_rjxy at 2007-09-08 19:39:54 on Problem 1674
不知道为什么就AC了.什么原理
int main()
{
	int n,i,j,t,k,a[10001];
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d",&i);
		for(j=1;j<=i;j++)
			scanf("%d",&a[j]);
		k=0;
		for(j=1;j<=i;j++)
		{
			if(a[j]!=j)
			{
				t=a[a[j]];
				a[a[j]]=a[j];
				a[j]=t;
				j--;
				k++;
			}
		}
		printf("%d\n",k);
	}
	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