Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么会Output Limit Exceed?求教各位神牛

Posted by 00748154 at 2008-02-17 13:36:31 on Problem 1026
这就是我的代码,无数次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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator