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. php 获取文件后缀名

    $file_ext = strtolower(substr(strrchr($upload_file, '.'), 1)); strrchr:查找指定字符在字符串中的最后一次出现 string str ...

  2. C++求最大公约数

    题目内容:求两个正整数的最大公约数. 输入描述:输入数据含有不多于50对的数据,每对数据由两个正整数(0<n1,n2<232)组成. 输出描述:对于每组数据n1和n2,计算最大公约数,每个 ...

  3. 【Django】Apache上运行单个Django项目,mod_wsgi配置

    1 安装环境 操作系统:Ubuntu 12.04 LTS 32 位(安装在VMware虚拟机中) python 版本: Python 2.7.3 Django版本 >>> djang ...

  4. wordpress 开发日志及技巧收集

    搜索结果数量提示 <?php /* Search Count */ $allsearch = &new WP_Query("s=$s&showposts=-1" ...

  5. Get 和 Post方法的登录

    1. Get & Post 1> Get请求直接从服务器拿数据 性能好 效率高 在地址栏会显示所有的参数,从直观上安全性不高 由于Get不提交数据给服务器,因此实际的安全性高 实际应用: ...

  6. SQL Server Analysis Services 数据挖掘

    假如你有一个购物类的网站,那么你如何给你的客户来推荐产品呢?这个功能在很多 电商类网站都有,那么,通过SQL Server Analysis Services的数据挖掘功能,你也可以轻松的来构建类似的 ...

  7. RTP、RTCP

    http://blog.chinaunix.net/uid-22670933-id-1771676.html

  8. iOS学习之C语言数据类型

    1.进制 0 1 2 3 4 5 6 7 8 9 A B C D E F 0X123(十六进制) 0123(八进制) 位权:单位数字的基本数值 2.数据类型 关键字    说明  字节大小 char  ...

  9. LNMP下wordpress无法切换主题,只显示当前主题解决方法

    最近在lnmp下发现wordpress后台无法切换主题,只能显示当前主题,开始还以为是文件没传完,又重置了一遍,还是一样.百度得知,原来军哥的LNMP安装包默认关闭了scandir函数,为了安全考虑. ...

  10. 微软职位内部推荐-Sr SDE

    微软近期Open的职位: MSN reaches nearly half a billion people across the globe where we are the #1 portal in ...