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

为什么RE呀??????????????????求救!!!!!!!

Posted by 20110531 at 2011-09-17 18:05:06 on Problem 1026
#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int a[210];//用于存放n个数字
char b[210],c[210];//用于存放message
char temp[10000][210];
int hanshu(int n)// 循环节 
{
	int i,k=1;
	while(1)
	{
		k++;
		for(i=1;i<=n;i++)
			temp[k][a[i]]=b[i];
		if(strcmp(temp[1]+1,temp[k]+1)==0)break;
		strcpy(b+1,temp[k]+1);
	}
	return k;
}
void hanshu2(int n,int len)// block
{   int i,num,k;
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
while(scanf("%d",&num)&&num)
{
	getchar();
	gets(b+1);
	len=strlen(b+1);
	if(len<n)
		for(i=len+1;i<=n;i++)
			b[i]=' ';
		b[n+1]='\0';
		strcpy(temp[1]+1,b+1);
		k=hanshu(n);
		
		printf("%s\n",temp[(num+1)%(k-1)]+1);
}
}
int main()
{
	int i,t,num,len,n;
	while(scanf("%d",&n)&&n)
	{
		
		hanshu2(n,len);
		printf("\n");
	}
	system("pause");
	return 0;
} 

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