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:请教 WA的有点郁闷

Posted by jordandandan at 2013-08-24 09:57:22 on Problem 1617
In Reply To:请教 WA的有点郁闷 Posted by:Nstd at 2010-05-23 14:01:29
> 这样能过:
> 
> #include "stdio.h"
> #include<string.h>
> int main()
> {
> 	char key[15],ip[105],turn[15][15],i;
> 	int j,a,b,keylen,iplen,p;
> 	while(scanf("%s",key)!=EOF && strcmp(key,"THEEND")){
> 		scanf("%s",ip);
> 		keylen=strlen(key);
> 		iplen=strlen(ip);
> 		b=iplen/keylen;
> 		p=0;
> 		
> 		for(i='A';i<='Z';i++)
> 			for(j=0;key[j];j++)
> 				if(i==key[j])
> 					for(a=0;a<b;a++,p++)
> 						turn[a][j]=ip[p];
> 
> 		for(i=0;i<b;i++)//以字符一个一个地输出
> 			for(j=0;j<keylen;j++)
> 				printf("%c",turn[i][j]);
> 		puts("");
> 		
> 	}
>     return 0;
> }
> 
> 这样就过不了:
> 
> #include "stdio.h"
> #include<string.h>
> int main()
> {
> 	char key[15],ip[105],turn[15][15],i;
> 	int j,a,b,keylen,iplen,p;
> 	while(scanf("%s",key)!=EOF && strcmp(key,"THEEND")){
> 		scanf("%s",ip);
> 		keylen=strlen(key);
> 		iplen=strlen(ip);
> 		b=iplen/keylen;
> 		p=0;
> 		
> 		for(i=0;i<keylen;i++) //上面的程序修改的是这个地方,这里是当成字符串来输出,上面是一个一个字符地输出
> 			turn[i][keylen]=0;
> 			
> 		for(i='A';i<='Z';i++)
> 			for(j=0;key[j];j++)
> 				if(i==key[j])
> 					for(a=0;a<b;a++,p++)
> 						turn[a][j]=ip[p];
> 
> 		for(i=0;i<b;i++)//以字符串一个单位一个单位地输出
> 			printf("%s",turn[i]);
> 		puts("");
> 		
> 	}
>     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