poj 1298(水题)
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 24241 | Accepted: 13227 |
Description
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
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
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(水题)的更多相关文章
- poj 1269 水题
题目链接:http://poj.org/problem?id=1269 #include<cstdio> #include<cstring> #include<cmath ...
- poj 2245 水题
求组合数,dfs即可 #include<cstdio> #include<iostream> #include<algorithm> #include<cst ...
- poj 3006水题打素数表
#include<stdio.h> #include<string.h> #define N 1100000 int isprim[N],prime[N]; void ispr ...
- POJ 3672 水题......
5分钟写完 水水更开心 //By SiriusRen #include <cstdio> #include <iostream> #include <algorithm& ...
- 【转】POJ百道水题列表
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...
- POJ 1488 Tex Quotes --- 水题
POJ 1488 题目大意:给定一篇文章,将它的左引号转成 ``(1的左边),右引号转成 ''(两个 ' ) 解题思路:水题,设置一个bool变量标记是左引号还是右引号即可 /* POJ 1488 T ...
- POJ 水题若干
POJ 3176 Cow Bowling 链接: http://poj.org/problem?id=3176 这道题可以算是dp入门吧.可以用一个二维数组从下向上来搜索从而得到最大值. 优化之后可以 ...
- poj 3080 Blue Jeans(水题 暴搜)
题目:http://poj.org/problem?id=3080 水题,暴搜 #include <iostream> #include<cstdio> #include< ...
- POJ 水题(刷题)进阶
转载请注明出处:優YoU http://blog.csdn.net/lyy289065406/article/details/6642573 部分解题报告添加新内容,除了原有的"大致题意&q ...
随机推荐
- 【Foreign】画方框 [主席树]
画方框 Time Limit: 10 Sec Memory Limit: 256 MB Description Input Output 输出一行一个整数,表示 CD 最多可能画了几个方框. Sam ...
- 【NOIP】普及组2011 表达式的值
[算法]动态规划+后缀表达式 [题解] 先把算式转为后缀表达式后进行DP 令f[s][0]表示使表达式答案为0的方案数 f[s][1]表示使表达式答案为1的方案数 (加法) f[a+b][1]=f[a ...
- python学习笔记(九)之字符串
定义字符串 >>> mystring = 'Hello Python' >>> name = str('Mountain') >>> mystri ...
- java 连接数据库报错:Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value '
1.解决方法: 报错信息为: Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server ti ...
- Sberbank Russian Housing Market比赛总结
第一次真正意义上参加kaggle比赛,都是工作之余看看别人的kernel,然后整理整理自己的分析代码. 总体来说,本次比赛对我而言更像一个入门比赛,更多的是走走kaggle比赛的整个流程,看看高手们都 ...
- devm_xxx机制
前言 devm是内核提供的基础机制,用于方便驱动开发者所分配资源的自动回收.参考内核文档devres.txt.总的来说,就是驱动开发者只需要调用这类接口分配期望的资源,不用关心释放问题.这些资源的释放 ...
- Linux 入门记录:十五、Linux 网络基本配置
一.以太网(Ethernet) 以太网(Ethernet)是一种计算机局域网技术.IEEE 组织的 IEEE 802.3 标准制定了以太网的技术标准,它规定了包括物理层的连线.电子信号和介质访问层协议 ...
- 安全测试===sqlmap(叁)转载
十五.操作系统控制 1.执行任意操作系统命令 参数:--os-cmd和--os-shell 若数据库管理系统是MySQL.PostgreSQL或微软的SQL Server且当前用户有相关权限Sqlma ...
- (十七)vmware无法将网络更改为桥接状态
故障现象,导致虚拟机无法正常上网 设备管理器中的驱动设备正常加载,但是注意这两个虚拟网卡是有问题的 将这两个虚拟网卡删除 只剩物理网卡了,重新启动电脑 将虚拟机里的网络设置删除 清空网卡后点击恢复默认 ...
- 【2017 Multi-University Training Contest - Team 1】小结
啊人生第一次打多校被虐 紧随yql的脚步做题. 1001: 可以发现我们平时表示的数都是$x*log_{10}{10}$,所以类似于做一个换底公式就可以了. -1是一个烟雾弹,因为小学生都知道2^n不 ...