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

我的为什么超时啊!! help!!!!!!!!!!!!!!!!!!!

Posted by sun_huangjian at 2007-08-25 11:35:20 on Problem 1674
/*
#include<stdio.h>
int a[100000];
int main()
{
	int i,j,n,m,t,k;
	scanf("%d",&n);
	while(n--)
	{
		t=0;
		scanf("%d",&m);
		for(i=0;i<m;i++)
		{
			scanf("%d",&a[i]);
		}
		for(i=1;i<=m;i++)
		{
			if(a[i-1]==i)
			{
				continue;
			}
			for(j=0;j<m;j++)
			{
				if(a[j]==i)
				{
					k=a[j];
					a[j]=a[i-1];
					a[i-1]=k;
					t++;
				}
			}
		}
	printf("%d\n",t);
	}
	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