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 xiao1590 at 2007-04-03 16:52:44 on Problem 1674
#include <stdio.h>

void main()
{
	int c,n,i,t,count,a[10010];
	scanf("%d",&c);
	while (c--)
	{
		count=0;
		scanf("%d",&n);
		for (i=1;i<=n;i++)
			scanf("%d",&a[i]);
		for (i=1;i<=n;i++)
		{
			if (a[i]!=i)
			{
				t=a[a[i]];
				a[a[i]]=a[i];
				a[i]=t;
				count++;
			}
		}
		printf("%d\n",count);
	}
}

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