ZOJ Problem Set - 1392 The Hardest Problem Ever

      放了一个长长的暑假,可能是这辈子最后一个这么长的暑假了吧,呵呵。。。今天来实验室了,先找了zoj上面简单的题目练练手直接贴代码了,不解释,就是一道简单的密文转换问题:

#include <stdio.h>
#include <string.h>

int main()
{
	char cText[1000];
	char start[10];
	char end[5];
	while(scanf("%s",start)!=EOF&&strcmp(start,"ENDOFINPUT")!=0)
	{
		getchar();
		gets(cText);
		scanf("%s",end);
		int i=0;
		while(cText[i]!='\0')
		{
			if(cText[i]>=70&&cText[i]<=90)
			{
				cText[i]-=5;
			}
			else if(cText[i]>=65&&cText[i]<70)
			{
				cText[i]=90-4+(cText[i]-65);
			}
			i++;
		}
		printf("%s\n",cText);
	}

	return 0;
}

  

posted @ 2013-09-04 11:04  xlturing  阅读(267)  评论(0编辑  收藏  举报