| ||||||||||
| 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 | |||||||||
我的为什么超时啊!! help!!!!!!!!!!!!!!!!!!!/*
#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator