ACM PKU 1298 The Hardest Problem Ever http://acm.pku.edu.cn/JudgeOnline/problem?id=1298
人有的时候真的很可鄙,可鄙就变成了可耻,可耻就喜欢做水题,我今天也可耻了一把,1298没什么好说的,水题一道:
#include <iostream> #include <string> using namespace std; char S[] = "START"; char E[] = "END"; char final[] ="ENDOFINPUT"; int main () { while (1) { char sentence[256]; gets(sentence); if(strcmp(final,sentence)==0) break; if (strcmp(S,sentence)==0) continue; if (strcmp(E,sentence)==0) continue; int longth=0; longth = strlen(sentence); for(int i=0;i<longth;i++) { if (sentence[i]<='Z'&&sentence[i]>='A') { sentence[i]=sentence[i]-5; if (sentence[i]<'A') sentence[i]=sentence[i]+26; } } cout<<sentence<<endl; } return 0; }