| ||||||||||
| 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 | |||||||||
为什么会Output Limit Exceed?求教各位神牛这就是我的代码,无数次OLE,当然VC里面是正常的~
#include<iostream>
#include<cstring>
#include<memory>
using namespace std;
int main()
{
int p,len,k,n,i;
int a[204],b[204];
int num[204][204];
char str[204],str0[204];
while(cin>>n)
{
if(n==0)
return 0;
memset(b,0,sizeof(b));
memset(num,0,sizeof(num));
for(i=1;i<=n;i++)
{
cin>>a[i];
num[i][0]=i;
}
for(i=1;i<=n;i++)
{
p=i;
while(1)
{
b[p]++;
i=a[i];
num[p][b[p]]=i;
if(i==p)
break;
}
}
while(1)
{
cin>>k;
if(k==0)
break;
cin.getline(str,200);
len=strlen(str);
for(i=len;i<=n;i++)
str[i]=' ';
for(i=1;i<=n;i++)
str0[num[i][k%b[i]]]=str[i];
for(i=1;i<=n;i++)
cout<<str0[i];
cout<<endl;
}
cout<<endl;
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator