标签:
Description
Input
Output
Sample Input
START NS BFW, JAJSYX TK NRUTWYFSHJ FWJ YMJ WJXZQY TK YWNANFQ HFZXJX END START N BTZQI WFYMJW GJ KNWXY NS F QNYYQJ NGJWNFS ANQQFLJ YMFS XJHTSI NS WTRJ END START IFSLJW PSTBX KZQQ BJQQ YMFY HFJXFW NX RTWJ IFSLJWTZX YMFS MJ END ENDOFINPUT
Sample Output
IN WAR, EVENTS OF IMPORTANCE ARE THE RESULT OF TRIVIAL CAUSES I WOULD RATHER BE FIRST IN A LITTLE IBERIAN VILLAGE THAN SECOND IN ROME DANGER KNOWS FULL WELL THAT CAESAR IS MORE DANGEROUS THAN HE
正解:模拟
解题报告:
没事做刷点水题。。。直接模拟就可以了
1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 #include<cstring> 5 #include<cstdlib> 6 #include<algorithm> 7 #include<vector> 8 using namespace std; 9 const int MAXN = 2016; 10 char ch[MAXN]; 11 12 inline int getint(){ 13 char c=getchar(); int w=0,q=0; 14 while(c!=‘-‘ && ( c<‘0‘ || c>‘9‘)) c=getchar(); 15 if(c==‘-‘) c=getchar(),q=1; 16 while(c>=‘0‘ && c<=‘9‘) w=w*10+c-‘0‘,c=getchar(); 17 return q?-w:w; 18 } 19 20 inline void solve(){ 21 while(1){ 22 scanf("%s",ch); 23 if(ch[0]==‘E‘) break; 24 //scanf("%s",ch); 25 //int l=strlen(ch); 26 char c=getchar(); 27 int l=-1; 28 do{ 29 c=getchar(); 30 ch[++l]=c; 31 if(c==‘\n‘) break; 32 }while(1); 33 for(int i=0;i<l;i++) { 34 if(ch[i]>=‘A‘ && ch[i]<=‘Z‘) { 35 ch[i]=ch[i]-5; 36 if(ch[i]<‘A‘) ch[i]+=26; 37 } 38 } 39 for(int i=0;i<l;i++) printf("%c",ch[i]); 40 printf("\n"); 41 scanf("%s",ch); 42 } 43 } 44 45 int main() 46 { 47 solve(); 48 return 0; 49 }
标签:
原文地址:http://www.cnblogs.com/ljh2000-jump/p/5597903.html