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 ...
随机推荐
- CSS animation怎么使用?(山东数漫江湖)
animation可以为很多CSS属性添加动画,比如: color, background-color, height和width.animation的动画需要使用@keyframes来定义,随后被a ...
- new操作符的内部运行解析
在加上new操作符,我们就能完成传统面向对象的class + new的方式创建对象,在Javascript中,我们将这类方式成为Pseudoclassical. 基于上面的例子,我们执行如下代码 ...
- Centos 7 安装jdk1.7
在linux中安装jdk是很平凡的事情了,刚学习linux给自己留下一笔记.刚安装centos其中可以会附带jdk,但是这并不影响,只要下载自己的jdk然后替换相对应的环境变量即可. 1.下载相对应的 ...
- 将资源文件夹中的文件通过流的方式写入到应用的File文件夹中
//1.在Files文件夹中创建同名的数据库文件 File files = getFilesDir(); File file = new File(files, DBName); if(file.ex ...
- Linux内核通知链机制的原理及实现【转】
转自:http://www.cnblogs.com/armlinux/archive/2011/11/11/2396781.html 一.概念: 大多数内核子系统都是相互独立的,因此某个子系统可能对其 ...
- popup menu案例,无说明只代码
效果图: 布局文件, 展示列表的容器 <?xml version="1.0" encoding="utf-8"?> <LinearLayout ...
- Web开发中,页面渲染方案
转载自:http://www.jianshu.com/p/d1d29e97f6b8 (在该文章中看到一段感兴趣的文字,转载过来) 在Web开发中,有两种主流的页面渲染方案: 服务器端渲染,通过页面渲染 ...
- SQL 列 转换成 查询出来的 行
查询 每个学生 的 (姓名,语文,数学,英语,成绩)为列 表结构如下: student: 学生表 grade 成绩表 : 查询出如下效果: SQL如下: select s.name,a.* fro ...
- P2327
code[class*="language-"] { padding: .1em; border-radius: .3em; white-space: normal; backgr ...
- 循环select查询结果集
--标记id --每次查询特定列比标记id大的第一条数据, --同时更新标记id,直到查询结果为空 ) set @id='' begin @id=id from T_SGZ where id>@ ...