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 |
求助各位同学,PE到死就是过不去交了不下10遍 次次PE,搞不清到底哪里除了问题。。太郁闷了|>_<| #include<iostream> using namespace std; int main() { int n,i,j,t,step[210][210],mod[210],next[210],ci; char in[210],out[210]; while(cin>>n&&n) { for(i=1;i<=n;i++) cin>>next[i]; memset(mod,0,sizeof(int)*210); memset(step,0,sizeof(int)*210*210); for(i=1;i<=n;i++) { j=i; do { j=next[j]; step[i][++mod[i]]=j; }while(j!=i); } while(cin>>ci&&ci) { memset(out,' ',sizeof(out)); getchar(); gets(&in[1]); in[n+1]=out[n+1]='\0'; for(i=1;in[i]!='\0';i++) { if(ci%mod[i]==0) out[i]=in[i]; else out[step[i][ci%mod[i]]]=in[i]; } for(i=strlen(&out[1]);out[i]==' ';i--) out[i]='\0'; puts(&out[1]); cout<<endl; } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator