(字符串 枚举)The Hardest Problem Ever hdu1048
The Hardest Problem Ever
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1048
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 31307 Accepted Submission(s):
14491
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.
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. This is the original message by Caesar.
N BTZQI WFYMJW GJ KNWXY NS F QNYYQJ NGJWNFS ANQQFLJ YMFS XJHTSI NS WTRJ
IFSLJW PSTBX KZQQ BJQQ YMFY HFJXFW NX RTWJ IFSLJWTZX YMFS MJ
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner inScanner = new Scanner(System.in);
while(inScanner.hasNext()) {
String string = inScanner.nextLine();
if(string.equals("ENDOFINPUT")) {
break;
}
else if(string.equals("START") || string.equals("END")) {
continue;
}
else {
for(int i = ;i<string.length();i++) {
if(string.charAt(i)>='A' && string.charAt(i)<='E') {
System.out.printf("%c",string.charAt(i)+-);
}
else if(string.charAt(i)>='F'&&string.charAt(i)<='Z'){
System.out.printf("%c", string.charAt(i)-);
}
else {
System.out.printf("%c",string.charAt(i));
}
}
}
System.out.println();
}
}
}
(字符串 枚举)The Hardest Problem Ever hdu1048的更多相关文章
- The Hardest Problem Ever(字符串)
The Hardest Problem Ever Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 24039 Accept ...
- HDUOJ-------The Hardest Problem Ever
The Hardest Problem Ever Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java ...
- hdu_1048_The Hardest Problem Ever_201311052052
The Hardest Problem Ever Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java ...
- HDU1048The Hardest Problem Ever
The Hardest Problem Ever Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & ...
- POJ 1298 The Hardest Problem Ever【字符串】
Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was ke ...
- Poj1298_The Hardest Problem Ever(水题)
一.Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar eve ...
- poj1298 The Hardest Problem Ever 简单题
链接:http://poj.org/problem?id=1298&lang=default&change=true 简单的入门题目也有这么强悍的技巧啊!! 书上面的代码: 很厉害有没 ...
- HDOJ 1048 The Hardest Problem Ever(加密解密类)
Problem Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caes ...
- C - The Hardest Problem Ever
Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever ...
随机推荐
- 神烦之float
另外一篇文章 : css float 一 历史 Float的设计初衷仅仅是:文字环绕效果(向word中的文字环绕效果) 二 特性 1.包裹性:块级元素如果不设置float,它默认会撑满整个屏幕,而如果 ...
- yum的使用与配置
yum简介 yum,是Yellow dog Updater, Modified 的简称,是杜克大学为了提高RPM 软件包安装性而开发的一种软件包管理器.起初是由yellow dog 这一发行版的开发者 ...
- 数据库 -- mysql记录操作
一,概括 MySQL数据操作: DML 在MySQL管理软件中,可以通过SQL语句中的DML语言来实现数据的操作,包括 使用INSERT实现数据的插入 UPDATE实现数据的更新 使用DELETE实现 ...
- [NOIP2017] 逛公园 【最短路】【强连通分量】
题目分析: 首先考虑无数条的情况.出现这种情况一定是一条合法路径经过了$ 0 $环中的点.那么预先判出$ 0 $环中的点和其与$ 1 $和$ n $的距离.加起来若离最短路径不超过$ k $则输出$ ...
- 【BZOJ3456】轩辕朗的城市规划 无向连通图计数 CDQ分治 FFT 多项式求逆 多项式ln
题解 分治FFT 设\(f_i\)为\(i\)个点组成的无向图个数,\(g_i\)为\(i\)个点组成的无向连通图个数 经过简单的推导(枚举\(1\)所在的连通块大小),有: \[ f_i=2^{\f ...
- Hdoj 2084.数塔 题解
Problem Description 在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的: 有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大 ...
- 如何将Drawable转为Bitmap?
本文选自StackOverflow(简称:SOF)精选问答汇总系列文章之一,本系列文章将为读者分享国外最优质的精彩问与答,供读者学习和了解国外最新技术.本文将讲解如何将Drawable转为Bitmap ...
- css元素溢出
当子元素的尺寸超过父元素的尺寸时,需要设置父元素显示溢出的子元素的方式,设置的方法是通过overflow属性来设置. overflow的设置项: 1.visible 默认值.内容不会被修剪,会呈现在元 ...
- 自适应PC端网页制作使用REM
做一个PC端的网页,设计图是1920X1080的. 要在常见屏上显示正常(比例正确可) 1280X720 1366X768 1440X900 1920X1080 使用了几种办法 1.内容在一屏内显示的 ...
- Diagnostic Trouble Code诊断故障码
所有电子控制单元(ECU)都会根据整车厂规范要求对相关故障进行记录,并储存在NVM(也称作EEPROM)相当于平常电脑上硬盘里.除故障代码外,还会记录故障发生时相关整车情况(如供电电压,环境温度 ...