The Hardest Problem Ever

Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

 

Description

Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was keeping himself alive. In order for him to survive, he decided to create one of the first ciphers. This cipher was so incredibly sound, that no one could figure it out without knowing how it worked. 
You are a sub captain of Caesar's army. It is your job to decipher the messages sent by Caesar and provide to your general. The code is simple. For each letter in a plaintext message, you shift it five places to the right to create the secure message (i.e., if the letter is 'A', the cipher text would be 'F'). Since you are creating plain text out of Caesar's messages, you will do the opposite: 

Cipher text 
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 

Plain text 
V W X Y Z A B C D E F G H I J K L M N O P Q R S T U 

Only letters are shifted in this cipher. Any non-alphabetical character should remain the same, and all alphabetical characters will be upper case. 

 

Input

Input to this problem will consist of a (non-empty) series of up to 100 data sets. Each data set will be formatted according to the following description, and there will be no blank lines separating data sets. All characters will be uppercase. 

A single data set has 3 components: 

Start line - A single line, "START" 

Cipher message - A single line containing from one to two hundred characters, inclusive, comprising a single message from Caesar 

End line - A single line, "END" 

Following the final data set will be a single line, "ENDOFINPUT". 

 

Output

For each data set, there will be exactly one line of output. This is the original message by Caesar. 
 

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
题意很简单,就是把上面的字母翻译成下面的字母
 #include<bits/stdc++.h>
using namespace std;
int main() {
char s[],s1[],s2[];
while(gets(s1)&&strcmp(s1,"START")==) {
gets(s);
int len=strlen(s);
for(int i=; i<len; i++) {
if(isupper(s[i]))
s[i]=(s[i]-'A'+)%+'A';
}
while(gets(s2)&&strcmp(s2,"END")==) {
puts(s);
break;
}
}
return ;
}

HDU1048The Hardest Problem Ever的更多相关文章

  1. The Hardest Problem Ever(字符串)

    The Hardest Problem Ever Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 24039   Accept ...

  2. (字符串 枚举)The Hardest Problem Ever hdu1048

    The Hardest Problem Ever 链接:http://acm.hdu.edu.cn/showproblem.php?pid=1048 Time Limit: 2000/1000 MS ...

  3. HDUOJ-------The Hardest Problem Ever

    The Hardest Problem Ever Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java ...

  4. hdu_1048_The Hardest Problem Ever_201311052052

    The Hardest Problem Ever Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java ...

  5. HDOJ 1048 The Hardest Problem Ever(加密解密类)

    Problem Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caes ...

  6. C - The Hardest Problem Ever

    Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever ...

  7. POJ 1298 The Hardest Problem Ever【字符串】

    Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was ke ...

  8. Poj1298_The Hardest Problem Ever(水题)

    一.Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar eve ...

  9. poj1298 The Hardest Problem Ever 简单题

    链接:http://poj.org/problem?id=1298&lang=default&change=true 简单的入门题目也有这么强悍的技巧啊!! 书上面的代码: 很厉害有没 ...

随机推荐

  1. Yii框架中使用PHPExcel导出Excel文件

    最近在研究PHP的Yii框架,很喜欢,碰到导出Excel的问题,研究了一下,就有了下面的方法: 1.首先在config\main.php中添加对PHPExcel的引用,我的方式是这样: 1 2 3 4 ...

  2. Nginx Location配置语法介绍、优先级说明

    nginx 语法规则:location   [=|~|~*|^~|!~|!~*]    /uri/   { … } location匹配的是$document_uri,$document_uri 会随 ...

  3. slidingmenu

        slidingmenu是一个开源组件.提供了左滑菜单和右滑菜单.下面是一个使用例子的工程源码.     在项目中不去管源码仅仅只是使用的话,主要需要实现的有3个类 MainActivity:这 ...

  4. Java 数组操作

    参考了网上别人的代码,在Java中对数组的比较便利的操作是 将数组转换成集合再利用集合所提供的add remove等方法进行增删,然后再转换成原数组类型 如 String[] --> 填充至 A ...

  5. DB2查询结果显示n行

    在SQLserver中语法是这样的:select top n * from staff ,即可查询显示n行数据 但是在DB2中语法是这样的,感觉比较接近英语. select * from STAFF ...

  6. bat文件编写(无线承载网络设置)

    就弄个例子,自己看执行效果,然后模仿写就行. 1)获取当前时间: @echo off set YEAR=%date:~0,4% set MONTH=%date:~5,2% set DAY=%date: ...

  7. MVC4.0 WebApi如何设置api支持namespace

    1.自定义HttpControllerSelector /// <summary> /// 设置api支持namespace /// </summary> public cla ...

  8. [转]Valgrind简单用法

    [转]Valgrind简单用法 http://www.cnblogs.com/sunyubo/archive/2010/05/05/2282170.html Valgrind的主要作者Julian S ...

  9. linq里的select和selectmany操作

    Select() 和 SelectMany() 的工作都是依据源值生成一个或多个结果值.Select() 为每个源值生成一个结果值.因此,总体结果是一个与源集合具有相同元素数目的集合.与之相反,Sel ...

  10. 37.altium designer中的class和rules?

    在布局布线工程中,遇到复杂工程时,难免要进行class和rules的设置,经过试验证明,class和rules的子目录是有优先级的.