(字符串 枚举)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 ...
随机推荐
- 一、linux扩展
1.linux-解压bz2文件提示tar (child): bzip2: Cannot exec: No such file or directory 原因,linux下没有bzip2解压工具 安装b ...
- 三、ASP.NET Core 部署Linux
预备工作 1.删除dotnet core sdk sudo yum erase libunwind libicu 2.删除链接 sudo rm -rf /usr/local/bin 3.sudo yu ...
- 一、纯css实现顶部进度条随滚动条滚动
一.效果图 二.直接复制粘贴 <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...
- How to split DMG on macOS
hdiutil segment /users/test/test1.dmg -segmentsize 4000m -o /users/test/test2.dmg
- linux环境 :LIBRARY_PATH, LD_LIBRARY_PATH区别
参考: https://www.cnblogs.com/mylinux/p/4955448.html LIBRARY_PATH和LD_LIBRARY_PATH是Linux下的两个环境变量,二者的含义和 ...
- Nginx IP地址透传
L:119
- Android系统启动概要
注:Java系统服务与本地系统服务标注反了 1.Linux内核 Android系统启动时,首先通过BootLoader(系统加载器)加载Linux内核,在Linux加载启动时,首先初始化内核,再调用i ...
- Spring Security 学习总结
Spring Security Spring Security是基于Spring提供声明式安全保护的安全性框架.Spring Security提供了完整的安全性解决方案,能够在Web请求级别和方法调用 ...
- yum的使用与配置
yum简介 yum,是Yellow dog Updater, Modified 的简称,是杜克大学为了提高RPM 软件包安装性而开发的一种软件包管理器.起初是由yellow dog 这一发行版的开发者 ...
- 「UVA10766」Organising the Organisation(生成树计数)
BUPT 2017 Summer Training (for 16) #6C 题意 n个点,完全图减去m条边,求生成树个数. 题解 注意可能会给重边. 然后就是生成树计数了. 代码 #include ...