| ||||||||||
| 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 | |||||||||
为什么会超时???#include <iostream>
#include <stdlib.h>
using namespace std;
int main(int argc, char *argv[])
{
int n,s,x[1000],y[1000],i,j;
scanf("%d%d",&n,&s);
for(i=1;i<=n;i++)
scanf("%d",&x[i]);
while(s--)
{
for(i=1;i<=n;i++)
{
y[i]=x[i];
for(j=0;j<n/2;j++)
y[i]=x[y[i]];
}
for(i=1;i<=n;i++)
x[i]=y[i];
}
for(i=1;i<=n;i++)
printf("%d\n",x[i]);
system("PAUSE");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator