六、IBM Minus One

2024-03-03 15:32
文章标签 one minus ibm

本文主要是介绍六、IBM Minus One,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

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

#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{int n,i,j=0,k;
char a[50];
cin>>n;
getchar(); 
while(j<n)
{i=0;while((a[i]=getchar())!='\n') {if(a[i]=='Z') a[i]='A';else a[i]=a[i]+1;i++;}
cout<<"String #"<<j+1<<endl;
for(k=0;k<i;k++)cout<<a[k];cout<<endl<<endl;j++;}return 0;}

这个题注意 最后输出也需要空一行;

这篇关于六、IBM Minus One的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/770066

相关文章

pytorch torch.nn.functional.one_hot函数介绍

torch.nn.functional.one_hot 是 PyTorch 中用于生成独热编码(one-hot encoding)张量的函数。独热编码是一种常用的编码方式,特别适用于分类任务或对离散的类别标签进行处理。该函数将整数张量的每个元素转换为一个独热向量。 函数签名 torch.nn.functional.one_hot(tensor, num_classes=-1) 参数 t

IBM Storwize V7000存储控制器故障节点报错574

背景:由于客户机房搬迁,需要下电迁移设备。该存储自2016年投入生产使用后,从未关过机,已正常运行七八年时间,期间只更换过硬盘,无其他硬件故障。 在GUI界面点击关闭系统后,大概等了40分钟,存储仍未关机,所有硬盘状态灯绿色常亮,面板无报错。到设备后面看控制器的状态,发现node2已经正常关机了,node1仍然在运行,又等了大概20分钟还没有关机,直接将电源线给拔掉了。 再次上电以后,发现

leetcode#66. Plus One

题目 Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any leading zero, except the number 0 itself. The digi

One-Shot Imitation Learning

发表时间:NIPS2017 论文链接:https://readpaper.com/pdf-annotate/note?pdfId=4557560538297540609&noteId=2424799047081637376 作者单位:Berkeley AI Research Lab, Work done while at OpenAI Yan Duan†§ , Marcin Andrychow

One-Shot Imitation Learning with Invariance Matching for Robotic Manipulation

发表时间:5 Jun 2024 论文链接:https://readpaper.com/pdf-annotate/note?pdfId=2408639872513958656&noteId=2408640378699078912 作者单位:Rutgers University Motivation:学习一个通用的policy,可以执行一组不同的操作任务,是机器人技术中一个有前途的新方向。然而,

51单片机-第十一节-DS18B20温度传感器(One_Wire单总线)

一、DS18B20温度传感器介绍: DS18B20是一种数字温度传感器。 测温范围:-55C - +125C 通信接口:1-Wire(单总线) 二、引脚及应用电路: 很简单,电源,接地,通讯接口。        三、内部结构: 总图: (1)备用电源 (2)器件地址 (3)控制器 (4)存储器 (5)存储器内部: B1,B2存储最低有效温度和最高有效温度。

Two to One——C语言提高题【7 kyu】

一、原题 链接:Training on Two to One | Codewars Take 2 strings s1 and s2 including only letters from a to z. Return a new sorted string (alphabetical ascending), the longest possible, containing distinct

If an application has more than one locale, then all the strings declared in one language should als

字符串资源多国语言版本的出错问题 假如你仅仅针对国内语言 加上这句即可 //保留中文支持resConfigs "zh"

More than one file was found with OS independent path ‘lib/arm64-v8a/libopencv_java4.so‘

解决方案: 在app下的build.gradle中加入以下代码: packagingOptions {pickFirst 'lib/arm64-v8a/libopencv_java4.so'}