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 190506040 at 2020-06-07 14:27:02 on Problem 1317
In Reply To:谁能帮忙看一下,为什么会WA Posted by:saren at 2007-08-01 15:19:56
> # include <stdio.h>
> # include <string.h>
> 
> main(){
> 	int key,len,i,temp;
> 	char code[75],plain[75];
> 	while (scanf("%d",&key),key){
> 		scanf("%s",code);
> 		len=strlen(code);
> 		plain[len]=0;
> 		for (i=0;i<len;i++){
> 			switch (code[i]){
> 			case '_' :	temp=(1+i)%28;break;
> 			case '.' : 	temp=(27+i)%28;break;
> 			default	 :	temp=(code[i]-'a'+1+i)%28;
> 			}
> 			switch (temp){
> 			case 0  :	plain[(i*key)%len]='_';break;
> 			case 27 :	plain[(i*key)%len]='.';break;
> 			default :	plain[(i*key)%len]=temp+'a'-1;
> 			}
> 		}
> 		puts(plain);
> 	}
> }

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