[HDU] [1048] The Hardest Problem Ever

Problem Description

Loading...

Problem Analysis

The statement is a bit long…
But the idea is still pretty simple
Not much to say…

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<stdio.h>
#include<string.h>
int main() {
	char s[120];
	int i;
	while(gets(s)) {
		if(!strcmp(s,"ENDOFINPUT"))
			break;
		else if(!strcmp(s,"START"))
			continue;
		else if(!strcmp(s,"END"))
			continue;
		else {
			for(i=0; i<strlen(s); i++) {
				if(s[i]<='Z'&&s[i]>='F')
					s[i]-=5;
				else if(s[i]>='A'&&s[i]<='E')
					s[i]+=21;
			}
			printf("%s\n",s);
		}
	}
	return 0;
}
This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...