IBM Minus One 简单字符处理
IBM Minus One
Time Limit:
2 Seconds Memory Limit:
65536 KB
You may have heard of the book '2001 - A Space Odyssey' by Arthur C. Clarke, or the film of the same name by Stanley Kubrick. In it a spaceship is sent from Earth to Saturn. The crew is put into stasis for the long flight, only
two men are awake, and the ship is controlled by the intelligent computer HAL. But during the flight HAL is acting more and more strangely, and even starts to kill the crew on board. We don't tell you how the story ends, in case you want to read the book for
yourself :-)
After the movie was released and became very popular, there was some discussion as to what the name 'HAL' actually meant. Some thought that it might be an abbreviation for 'Heuristic ALgorithm'. But the most popular explanation
is the following: if you replace every letter in the word HAL by its successor in the alphabet, you get ... IBM.
Perhaps there are even more acronyms related in this strange way! You are to write a program that may help to find this out.
Input
The input starts with the integer n on a line by itself - this is the number of strings to follow. The following n lines each contain one string of at most 50 upper-case letters.
Output
For each string in the input, first output the number of the string, as shown in the sample output. The print the string start is derived from the input string by replacing every time by the following letter in the alphabet,
and replacing 'Z' by 'A'.
Print a blank line after each test case.
Sample Input
2
HAL
SWERC
Sample Output
String #1
IBM
String #2
TXFSD
- #include<cstdio>
- #include<cstdlib>
- #include<iostream>
- #include<math.h>
- #include<string>
- using namespace std;
- char dic[]={' ','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'};
- void _solve(string s)
- {
- for(int i=0;i<s.length();i++)
- {
- if(s[i]=='Z') cout<<'A';
- else {
- int j=0;
- while(dic[j]!=s[i]) j++;
- cout<<dic[j+1];
- }
- }
- }
- int main()
- {
- int n;
- string str;
- cin>>n;
- for(int v=1;v<=n;v++)
- {
- cin>>str;
- cout<<"String #"<<v<<endl;
- _solve(str);
- cout<<endl<<endl;
- }
- return 0;
- }
- #include<cstdio>
- #include<cstdlib>
- #include<iostream>
- #include<math.h>
- #include<string>
- using namespace std;
- void _solve(string s)
- {
- for(int i=0;i<s.length();i++)
- {
- if(s[i]=='Z') cout<<'A';
- else cout<<char(s[i]+1);
- }
- }
- int main()
- {
- int n;
- string str;
- cin>>n;
- for(int v=1;v<=n;v++)
- {
- cin>>str;
- cout<<"String #"<<v<<endl;
- _solve(str);
- cout<<endl<<endl;
- }
- return 0;
- }
IBM Minus One 简单字符处理的更多相关文章
- Linux 简单字符设备驱动程序 (自顶向下)
第零章:扯扯淡 特此总结一下写的一个简单字符设备驱动程序的过程,我要强调一下“自顶向下”这个介绍方法,因为我觉得这样更容易让没有接触过设备驱动程序的童鞋更容易理解,“自顶向下”最初从<计算机网络 ...
- IBM Minus One(water)
IBM Minus One Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- HDU 1328 IBM Minus One
IBM Minus One Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- IBM Minus One
IBM Minus One Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
- 【Linux-驱动】简单字符设备驱动结构和初始化
(1)在编写简单字符设备驱动的时候,首先要申请一个设备结构struct cdev: struct cdev { struct kobject kobj; struct module *owner; / ...
- 【转】linux设备驱动程序之简单字符设备驱动
原文网址:http://www.cnblogs.com/geneil/archive/2011/12/03/2272869.html 一.linux系统将设备分为3类:字符设备.块设备.网络设备.使用 ...
- 简单字符串匹配 Brute
/* 很简单 模式匹配的Brute-Force算法 Brute-Force算法实现模式匹配的思想是:从主串s=”s0s1…sn-1”的第一个字符开始和模式串t=”t0t1…tn-1”的第一个字符比较, ...
- arm-linux字符设备驱动开发之---简单字符设备驱动
一.linux系统将设备分为3类:字符设备.块设备.网络设备.使用驱动程序: 1.字符设备:是指只能一个字节一个字节读写的设备,不能随机读取设备内存中的某一数据,读取数据需要按照先后数据.字符设备是面 ...
- ZOJ 1240 IBM Minus One
/* You may have heard of the book '2001 - A Space Odyssey' by Arthur C. Clarke, or the film of the s ...
随机推荐
- 为什么Java 两个Integer 中1000==1000为false而100==100为true?
详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt346 这是一个挺有意思的讨论话题. 如果你运行下面的代码 1 2 3 4 I ...
- WeTest+微信:小程序云端测试系统上线
日前,微信新增小程序测试系统,可便于开发者检测小程序缺陷,评估小程序产品质量.在小程序发布之前,开发者可将小程序代码提交到测试系统,在不同型号的手机真机上运行,执行完毕后自动生成测试报告.小程序云端测 ...
- 【Alpha】——Sixth Scrum Meeting
一.今日站立式会议照片 二.每个人的工作 成员 昨天已完成的工作 今天计划完成的工作 李永豪 对统计出现的问题进一步完善 学习将项目做成APK 郑靖涛 完善报表设计 协助设计账目一览表板块 杨海亮 测 ...
- 201521123002 《Java程序设计》第1周学习总结
1. 本章学习总结 学习使用Markdown编写文章 jdk的安装和环境变量的设置 java的历史,目前java有三大平台,javaSE,javaEE及javaME.其中javaSE我们会经常用到,由 ...
- 201521123007《Java程序设计》第9周学习总结
1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结异常相关内容. 2. 书面作业 本次PTA作业题集异常 1. 常用异常 题目5-1 1.1 截图你的提交结果(出现学号) 1.2 自 ...
- 201521123009 《Java程序设计》第11周学习总结
1. 本周学习总结 2. 书面作业 本次PTA作业题集多线程 Q1:互斥访问与同步访问 完成题集4-4(互斥访问)与4-5(同步访问) 1.1 除了使用synchronized修饰方法实现互斥同步访问 ...
- Java 最常用类(前100名)来自一万个开源项目
大部分的 Java 软件开发都会使用到各种不同的库.近日我们从一万个开源的 Java 项目中进行分析,从中提取出最常用的 Java 类,这些类有来自于 Java 的标准库,也有第三方库.每个类在同一个 ...
- [3] 微信公众号开发 - 结合UEditor实现图文消息群发功能
0.写在前面的话 如何实现微信平台后台管理中的,图文消息发送功能? 大概的过程如下: 通过类似表单的形式,将文章各部分内容提交到后台,封装成一个实体类,并持久化到数据库中 需要推送的时候,将不同的文章 ...
- Python学习笔记005_文件_OS_模块_pickle
>>> >>> # 文件 open()方法是打开文件,它有很多参数,第一个文件名是必须的(带路径)>>> >>> f = ope ...
- appium python andiroid自动化文档整理笔记
from appium import webdriver import time,unittest,HTMLTestRunner class Testlogin(unittest.TestCase): ...