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. Creating a new dynamic form project, business modeling.

    The domain logic is like there are a bunch of objects, as well as a lot of configurations, according ...

  2. 全面了解Nginx主要应用场景(数漫江湖)

    前言 本文只针对Nginx在不加载第三方模块的情况能处理哪些事情,由于第三方模块太多所以也介绍不完,当然本文本身也可能介绍的不完整,毕竟只是我个人使用过和了解到过得.所以还请见谅,同时欢迎留言交流 N ...

  3. HDU 2059 龟兔赛跑 (dp)

    题目链接 Problem Description 据说在很久很久以前,可怜的兔子经历了人生中最大的打击--赛跑输给乌龟后,心中郁闷,发誓要报仇雪恨,于是躲进了杭州下沙某农业园卧薪尝胆潜心修炼,终于练成 ...

  4. 2017-2018-1 20179205《Linux内核原理与设计》第四周作业

    <Linux内核原理与分析> 视频学习及实验操作 Linux内核源代码 视频中提到了三个我们要重点专注的目录下的代码,一个是arch目录下的x86,支持不同cpu体系架构的源代码:第二个是 ...

  5. linux安装lamp

    github https://github.com/zblogcn/zblogphp Installation If your server system: CentOS yum -y install ...

  6. Python【模块】importlib,requests

    内容概要:      模仿django中间件的加载方式      importlib模块      requests模块  rsplit()   用实际使用的理解来解释两个模块 importlib模块 ...

  7. FreeRADIUS + MySQL 安装配置笔记

    FreeRADIUS + MySQL 安装配置笔记 https://www.2cto.com/net/201110/106597.html

  8. 转 白话解析:一致性哈希算法 consistent hashing

    摘要: 本文首先以一个经典的分布式缓存的应用场景为铺垫,在了解了这个应用场景之后,生动而又不失风趣地介绍了一致性哈希算法,同时也明确给出了一致性哈希算法的优点.存在的问题及其解决办法. 声明与致谢: ...

  9. 【bzoj4373】算术天才⑨与等差数列

    同之前那道由乃题,可以认为由乃题是这题的特殊情况…… 维护方法是同样的,维护区间和,区间平方和即可. 注意特判一个数(其实没有必要) #include<bits/stdc++.h> ; u ...

  10. MariaDB 层常用业务

    前言  -  简单准备一下前戏 前面写过几篇mariadb 数据的随笔, 多数偏C/C++层面. 这次分享一下平时开发中, 处理的一些数据层面的业务. 对于MariaDB, 不做过多介绍. 如果你有U ...