HDOJ/HDU 1328 IBM Minus One(水题一个,试试手)

时间:2023-01-19 08:58:48

Problem Description

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

题意就是:输入一个大写的字符串,输出每一个大写字母后的一个大写字母。

如果遇到Z就输出A。

注意每一个测试后都有一个空行。

水题一个!

import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t =sc.nextInt();
int ti=0;
while(t-->0){
String str = sc.next();
System.out.println("String #"+(++ti));
for(int i=0;i<str.length();i++){
if(str.charAt(i)=='Z'){
System.out.print("A");
}else{
System.out.print((char)(str.charAt(i)+1));
}
}
System.out.println();
System.out.println();
}
}
}

HDOJ/HDU 1328 IBM Minus One(水题一个,试试手)的更多相关文章

  1. HDOJ&lpar;HDU&rpar; 2090 算菜价&lpar;简单水题、&rpar;

    Problem Description 妈妈每天都要出去买菜,但是回来后,兜里的钱也懒得数一数,到底花了多少钱真是一笔糊涂帐.现在好了,作为好儿子(女儿)的你可以给她用程序算一下了,呵呵. Input ...

  2. HDOJ&lpar;HDU&rpar; 1555 How many days&quest;&lpar;水题&rpar;

    Problem Description 8600的手机每天消费1元,每消费K元就可以获赠1元,一开始8600有M元,问最多可以用多少天? Input 输入包括多个测试实例.每个测试实例包括2个整数M, ...

  3. HDU 1328 IBM Minus One

    IBM Minus One Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tot ...

  4. HDOJ&sol;HDU 2537 8球胜负&lpar;水题&period;简单的判断&rpar;

    Problem Description 8球是一种台球竞赛的规则.台面上有7个红球.7个黄球以及一个黑球,当然还有一个白球.对于本题,我们使用如下的简化规则:红.黄两名选手轮流用白球击打各自颜色的球, ...

  5. HDOJ&lpar;HDU&rpar; 2139 Calculate the formula&lpar;水题,又一个用JavaAC不了的题目&rpar;

    Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) 看到这个时间,我懵逼了... 果然,J ...

  6. HDOJ&sol;HDU 2561 第二小整数&lpar;水题~排序~&rpar;

    Problem Description 求n个整数中倒数第二小的数. 每一个整数都独立看成一个数,比如,有三个数分别是1,1,3,那么,第二小的数就是1. Input 输入包含多组测试数据. 输入的第 ...

  7. HDOJ&lpar;HDU&rpar; 1562 Guess the number&lpar;水题,枚举就行&rpar;

    Problem Description Happy new year to everybody! Now, I want you to guess a minimum number x betwwn ...

  8. hdu 2041&colon;超级楼梯(水题,递归)

    超级楼梯 Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s): Accepted Su ...

  9. HDU 5578 Friendship of Frog 水题

    Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...

随机推荐

  1. vue&period;js初探

    前言 入手2016最火前端框架之一vue.js.大概从网上找了些资料看了下vue.js,从网上的资料来看只能惊叹其发展速度太快,让我意外的是其作者是华人的前提下作品这么受欢迎. 网上的博客和教程各种组 ...

  2. R3&period;2&period;2安装

  3. Eclipse,myeclipse开发中常用技巧总结

    一.myeclipse自带包和自己部署的包冲突解决问题方案 原来的依赖设置: 修改后的配置: 二.取消Myeclipse的自动文件验证来增加myeclipse速度 1.Windows –> Pe ...

  4. C&num; 如何读取一行中的所有变量

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  5. &lbrack;Javascript&rsqb; Implement zip function

    1. Use a for loop to traverse the videos and bookmarks array at the same time. For each video and bo ...

  6. jquery 判断当前上传文件大小限制上传格式 搭配thinkphp实现上传即预览(模拟异步上传)

    在web开发中,最纠结的一项就是文件上传,最近由于项目需要前后摸索了四天在这里分享给大家.如有不足,望指出!! 前台:jquery.easyui.html 后台:thinkphp 主要涉及语言:jqu ...

  7. 跨Storyboard调用

    在开发中我们会有这种需求从一个故事板跳到另一个故事板 modal UIStoryboard *secondStoryboard = [UIStoryboard storyboardWithName:@ ...

  8. 树链剖分——NOI2015

    8说了上代码 给定一棵树,两种操作 a x:x->root路径上的点权值置1 b x: 把x的子树所有结点权值置0 树上的区间更新操作,显然是要维护dfs 第一个操作暴力显然是t,用树剖把复杂度 ...

  9. python使用grpc调用rpc接口

    proto文件: syntax = "proto3"; package coupon; // //message UnsetUseC2URequest { // int64 bid ...

  10. 基于sql service会话共享,实现SSO

    1:session的存储基于sql service数据库来存储 2:修改sql service中会话管理的系统存储过程 3:实现几个站点的会话共享 4:应用共享会话,实现单点登录