| ||||||||||
| 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 | |||||||||
崩溃了不知道为什么就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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator