The Hardest Problem Ever

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 13035    Accepted Submission(s): 5905

Problem 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
 
Source
 
此题为简单的字符串处理问题....
但是要注意数组开大点....1000足矣;
  1. #include<iostream>
  2. #include<cstring>
  3. #include<cstdlib>
  4. char str[]="VWXYZABCDEFGHIJKLMNOPQRSTU";
  5. char a[];
  6. int main()
  7. {
  8. int i;
  9. // freopen("test.in","r",stdin);
  10. // freopen("test.out","w",stdout);
  11. while(scanf("%[^\n]",a)!=EOF)
  12. {
  13. if(strcmp("ENDOFINPUT",a)==)
  14. break;
  15. if(strcmp("START",a)!=&&strcmp("END",a)!=)
  16. {
  17. for(i=;i<strlen(a);i++)
  18. {
  19. if(a[i]>='A'&&a[i]<='Z')
  20. printf("%c",str[a[i]-'A']);
  21. else
  22. printf("%c",a[i]);
  23. }
  24. puts("");
  25. }
  26. a[]=;
  27. getchar();
  28. }
  29. return ;
  30. }
 

HDUOJ-------The Hardest Problem Ever的更多相关文章

  1. HDU1048The Hardest Problem Ever

    The Hardest Problem Ever Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & ...

  2. The Hardest Problem Ever(字符串)

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

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

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

  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. ORACLE中union/union all/Intersect/Minus用法

    Union,对两个结果集进行并集操作,不包括重复行,同时进行默认规则的排序: Union All,对两个结果集进行并集操作,包括重复行,不进行排序: Intersect,对两个结果集进行交集操作,不包 ...

  2. 建模角度理解word embedding及tensorflow实现

    http://www.jianshu.com/p/d44ce1e3ec2f 1. 前言 本篇主要介绍关键词的向量表示,也就是大家熟悉的word embedding.自Google 2013 年开源wo ...

  3. Shader开发工具: PVRShaman

    1. A PVRShaman (.POD) workspace is provided as an example in the Chapter_10/PVR_LinearFog folder tha ...

  4. Wifidog初分析

    一.综述 wifidog是搭建无线热点认证系统的解决方案之一,他比nocat.nodog更适合互联网营销思路.常见的使用在openwrt系统上,它实现了路由器和认证服务器的数据交互,在路由器方(客户端 ...

  5. chrome插件编写基本入门

    chrome插件编写基本入门  http://igeekbar.com/igeekbar/post/331.htm #精选JAVASCRIPTCHROME 作为一名程序猿,怎么能不会写chrome插件 ...

  6. Log4j中conversionPattern的含义

    %a -- 表示礼拜几,英文缩写形式,比如“Fri”%A -- 表示礼拜几,比如“Friday”%b -- 表示几月份,英文缩写形式,比如“Oct”%B -- 表示几月份,“October”%c -- ...

  7. C#.NET常见问题(FAQ)-如何让控件或者窗体本身全屏

    初始化的时候保存控件的原始尺寸,然后通过Dock属性调节   注意如果你的控件是放在容器中的,那么对应设置的也要是容器的Dock属性   全屏的效果如下图所示   更多教学视频和资料下载,欢迎关注以下 ...

  8. 解决IE兼容模式的方案

    在html头 加标签 强制使用最新的ie渲染 <meta http-equiv="X-UA-Compatible" content="IE=edge"&g ...

  9. jQuery.cookie应用操作

    //1.插件框架: /* * name @键 * value @值 * options @选项,包括有效期 路径 域名等 */ jQuery.cookie = function(name, value ...

  10. 牛客网-《剑指offer》-重建二叉树

    题目:http://www.nowcoder.com/practice/8a19cbe657394eeaac2f6ea9b0f6fcf6 C++ /** * Definition for binary ...