POJ 1298 The Hardest Problem Ever

...直接找下对应关系..

#include <cstdio>
#include <cstring>
using namespace std;
int main(){
	char line[105];
	while(gets(line)){
		if(strcmp(line,"START")==0||strcmp(line,"END")==0)continue;
		if(strcmp(line,"ENDOFINPUT")==0)break;
		int len=strlen(line);
		for(int i=0;i<len;i++){
			if(line[i]>='A'&&line[i]<='E'){
				line[i]=line[i]+21;
			}else if(line[i]>='F'&&line[i]<='Z'){
				line[i]=line[i]-5;
			}
		}
		puts(line);
	}
	return 0;
}


你可能感兴趣的:(POJ 1298 The Hardest Problem Ever)