| ||||||||||
| 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 | |||||||||
Re:为什么会Output Limit Exceed?求教各位神牛In Reply To:为什么会Output Limit Exceed?求教各位神牛 Posted by:00748154 at 2008-02-17 13:36:31 > 这就是我的代码,无数次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];//注意这个位置,与for循环中i相同,换另一个索引
> num[p][b[p]]=i;
> if(i==p)
> break;
> }
> }
> while(1)
> {
> cin>>k;
> if(k==0)
> break;
getchar();//加上输入空格的语句
> 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