(字符串 枚举)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 ...
随机推荐
- Lodop连续打印内容逐渐偏移怎么办
Lodop打印控件中,可以使用打印机自带的纸张名称,也可以自定义纸张.(SET_PRINT_PAGESIZE语句).通常进行打印开发,为了避免浪费纸张,会用虚拟打印机效果作为依据,虚拟打印机连续打印多 ...
- JS判断语句 注意多句时加大括号 回调函数LODOP兼顾写法
由于C-LODOP获取一些动作函数的返回值,需要用回调函数,由于常见的使用方法是混合部署,也就是同一个页面,根据浏览器的不同,可能会走LODOP ,也可能会走C-LODOP,因此写法要坚固两种,而有些 ...
- PC平台的SIMD支持检测
如果我们希望在用SIMD来提升程序处理的性能,首先需要做的就是检测程序所运行的平台是否支持相应的SIMD扩展.平台对SIMD扩展分为两部分的支持: CPU对SIMD扩展的支持.SIMD扩展是随着CPU ...
- 人工智能将继续壮大,两会委员建议增加“AI+教育”支持板块
导读 今年上海两会期间,上海市政协委员.上海交通大学机械与动力工程学院教授范秀敏提交提案,建议政府在推进上海人工智能专项建设中,增加“AI+教育”专项支持板块,并鼓励集聚发展AI产业的各个区,在人工智 ...
- ubuntu终端快捷键
ctrl+alt+t 新终端 ctrl+shift+t打开新的标签页 ctrl+d关闭终端 ctrl+s 暂停屏幕输出 ctrl+q 继续屏幕输出 ctrl+l 清屏 ctrl+alt+f1 切换到第 ...
- 使用Guava获取某一个类的指定超类上的泛型Type T
package com.geostar.gfstack.operationcenter.log.common.hibernate; import com.geostar.gfstack.operati ...
- [BZOJ 2705] [SDOI 2012] Longge的问题
Description Longge的数学成绩非常好,并且他非常乐于挑战高难度的数学问题.现在问题来了:给定一个整数 \(N\),你需要求出 \(\sum gcd(i, N)(1\le i \le N ...
- Git——取消merge状态
MERGING状态 取消MERGING 查看更新历史 $ git reflog 恢复之前状态 $ git reset --hard 06a5578
- 微信小程序——创建自己的第一个小程序【一】
注册 微信小程序注册 https://mp.weixin.qq.com/wxopen/waregister?action=step1 填写账号信息 作为登录帐号,请填写未被微信公众平台注册,未被 ...
- Code POJ - 1850 组合数学
题意 :字符串从a=1 b=2 c=3....z=26 ab=27开始编号 每个都是升序的 给出字符串问是几号 思路:主要是要看n位字符串有多少个 这里需要用组合数学的思想 组合数用杨辉三角形递推 ...