The Hardest Problem Ever
Time Limit: 1000MS   Memory Limit: 10000K
Total Submissions: 24241   Accepted: 13227

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:

  1. Start line - A single line, "START"
  2. Cipher message - A single line containing from one to two
    hundred characters, inclusive, comprising a single message from Caesar
  3. 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

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
int main(){
// freopen("in.txt","r",stdin);
string s,s1,s2;
char m[]="VWXYZABCDEFGHIJKLMNOPQRSTU";
int j,k;
while(cin>>s){
if(s=="ENDOFINPUT")
break;
cin.ignore(INT_MAX,'\n');
getline(cin,s1,'\n');
j=s1.size();
for(int i=;i<j;i++){
if(s1[i]>='A'&&s1[i]<='Z')
cout<<m[s1[i]-'A'];
else
cout<<s1[i];
}
cin>>s2;
cout<<endl;
}
return ;
}

poj 1298(水题)的更多相关文章

  1. poj 1269 水题

    题目链接:http://poj.org/problem?id=1269 #include<cstdio> #include<cstring> #include<cmath ...

  2. poj 2245 水题

    求组合数,dfs即可 #include<cstdio> #include<iostream> #include<algorithm> #include<cst ...

  3. poj 3006水题打素数表

    #include<stdio.h> #include<string.h> #define N 1100000 int isprim[N],prime[N]; void ispr ...

  4. POJ 3672 水题......

    5分钟写完 水水更开心 //By SiriusRen #include <cstdio> #include <iostream> #include <algorithm& ...

  5. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  6. POJ 1488 Tex Quotes --- 水题

    POJ 1488 题目大意:给定一篇文章,将它的左引号转成 ``(1的左边),右引号转成 ''(两个 ' ) 解题思路:水题,设置一个bool变量标记是左引号还是右引号即可 /* POJ 1488 T ...

  7. POJ 水题若干

    POJ 3176 Cow Bowling 链接: http://poj.org/problem?id=3176 这道题可以算是dp入门吧.可以用一个二维数组从下向上来搜索从而得到最大值. 优化之后可以 ...

  8. poj 3080 Blue Jeans(水题 暴搜)

    题目:http://poj.org/problem?id=3080 水题,暴搜 #include <iostream> #include<cstdio> #include< ...

  9. POJ 水题(刷题)进阶

    转载请注明出处:優YoU http://blog.csdn.net/lyy289065406/article/details/6642573 部分解题报告添加新内容,除了原有的"大致题意&q ...

随机推荐

  1. Jmeter-12-如何使用Plugin Manager

    1. 搜索 Jmeter plugin 并找到plugin manager 下载jar文件 2. 放到jmeter/lib/ext下面, 重启jmeter 3. 找到选项-> Plugin ma ...

  2. Vue 使用中的小技巧(山东数漫江湖)

    在vue的使用过程中会遇到各种场景,当普通使用时觉得没什么,但是或许优化一下可以更高效更优美的进行开发.下面有一些我在日常开发的时候用到的小技巧,在下将不定期更新~ 1. 多图表resize事件去中心 ...

  3. vue装逼神器简述

    主要是分享下用vuejs开发项目过程中遇到的问题,vuejs开发的优势和需要注意的地方. 项目主要页面:主页,最新,分类,分类列表,详情页,结果页,斗图(列表,制作页) 效果图: 地址:https:/ ...

  4. 今天安装了arch,感觉不错,这速度可以

    虽然没有想想中的那么那么快,不过已经可以了 总结一下遇到的问题以及i自己安装的软件 1.u盘硬盘不能自动挂载 安装gvfs 2.不能读写挂载 安装ntfs-3g 3.时间不对 照wiki上的说 #ln ...

  5. linux编程之信号

    信号(signal)机制是UNIX系统中最为古老的进程之间的通信机制,它用在一个或多个进程之间传递异步信号,信号可以由各种异步事件产生,如: 键盘中断等等,在Linux 的shell 中,也可以使用信 ...

  6. 【Android XML】Android XML 转 Java Code 系列之 style(3)

    最近一个月把代码重构了一遍, 感觉舒服多了, 但总体开发进度没有变化.. 今天聊聊把style属性转换成Java代码的办法 先说结论: 引用系统style是无法完美的实现的, 我们如果有写成Java代 ...

  7. python基础===输入必须为数字的检验的另一种方法

    print("[+]welcome to python3") while True: num = input("please input a num:") if ...

  8. 数据类型转换(计算mac地址)

    [root@localhost test1]# vim 19.py //add #!/usr/bin/python macaddr = '00:0C:29:D1:6F:E9' prefix_mac = ...

  9. ansible安装和配置

    一.安装ansible准备 //安装准备 .两台机器 172.7.15.106 172.7.15.111 .设置hostname以及hosts 172.7.15.106 web9.lulu.com 1 ...

  10. vue 组件中数据传递

    //有种形式的传递:从父到子,从子到父,平行级别的传递//首先第一种:从父到子,用props属性绑定 //父级数据: new vue({ "el":"#app" ...