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

个人觉得代码已经正确了,而且细节问题基本都注意了,但是就是一直WA,请高人指点

Posted by scuwf at 2011-09-24 13:32:41 on Problem 1026
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAXSIZE 200
int main(void)
{
	int pos,temp,accum,queue[MAXSIZE],count,record[MAXSIZE];
	unsigned int len,i,n;
	char str[MAXSIZE];
	char final[MAXSIZE];
	while(scanf("%d",&n) && (n!=0))
	{
		for(i=0;i<n;i++)
		{
			scanf("%d",&queue[i]);
		}
		while(scanf("%d",&accum) && (accum!=0))
		{
			getchar();
			gets(str);
			len=strlen(str);
			for(i=0;i<n-len;i++)
			{
				str[len+i]=' ';
			}
			str[len+i]='\0';
			for(i=0;i<n;i++)
			{
				pos=temp=i;
				count=1;
				record[0]=i;
				while(pos!=(queue[temp]-1))
				{
					temp=queue[temp]-1;
					record[count]=temp;
					count++;
				}
				final[record[accum%count]]=str[i];
			}
			final[n]='\0';
			printf("%s\n",final);
		}
		printf("\n");
	}
	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