hd acm1048

Problem Description

Julius Caesar lived in a time of danger and intrigue. 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.

Input

Input to this problem will consist of a (non-empty) 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

For each data set, there will be exactly one line of output. This is the original message by Caesar.

Sample Input

START

NS BFW, JAJSYX TK NRUTWYFSHJ FWJ YMJ WJXZQY TK YWNANFQ HFZXJX

END

START

N BTZQI WFYMJW GJ KNWXY NS F QNYYQJ NGJWNFS ANQQFLJ YMFS XJHTSI NS WTRJ

END

START

IFSLJW PSTBX KZQQ BJQQ YMFY HFJXFW NX RTWJ IFSLJWTZX YMFS MJ

END

ENDOFINPUT

Sample Output

IN WAR, EVENTS OF IMPORTANCE ARE THE RESULT OF TRIVIAL CAUSES

I WOULD RATHER BE FIRST IN A LITTLE IBERIAN VILLAGE THAN SECOND IN ROME

DANGER KNOWS FULL WELL THAT CAESAR IS MORE DANGEROUS THAN HE

Sample Way

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

int main()
{
  char cipher[3][200]; //用来存储每一个数据集
  int j,k;
  while(1)
  {
    for(j=0;j<3;j++)
    {
      gets(cipher[j]); //将每行的信息读入到数组中
      if(j==1)
      {
        k=0;
        while(cipher[1][k]!=‘\0‘) //破译密文
        {
        if(cipher[1][k]<‘F‘&&isupper(cipher[1][k]))
             cipher[1][k]+=21;
        else if(isupper(cipher[1][k]))
           cipher[1][k]-=5;
        k++;
           }
      }
    }
  if(strcmp(cipher[0],"ENDOFINPUT")!=0) puts(cipher[1]); //输出结果
  if(strcmp(cipher[0],"ENDOFINPUT")==0) break; //输入结束的标志
  }
return 0;
}

时间: 2024-10-25 03:14:11

hd acm1048的相关文章

怎么用HD Tune检测硬盘坏道

HD Tune软件不仅小巧而且很易使用,是一款检测电脑硬盘的优良工具.不仅是电脑硬盘,包括移动硬盘在内一样可以检测.那么,如何使用HD Tune呢?如何使用HD Tune检测磁盘坏道呢? 工具/原料 HD Tune软件一枚 使用HD Tune检查硬盘坏道 1.百度搜索下载HD Tune软件,注意:尽量选择系统之家官网上下载这类软件,因为系统之家上的软件不会捆绑的流氓软件 2.软件打开之后,界面如图,最上方显示硬盘的厂家信息,图示红色遮挡区 3.点击选项卡切换至错误扫描,如图,然后在红框位置,尽量

uva 12452 Plants vs. Zombies HD SP (树DP)

Problem I: Plants vs. Zombies HD Super Pro Plants versus Zombies HD Super Pro is a game played not a grid, but on a connected graph G with no cycles (i.e., a tree). Zombies live on edges of the tree and chew through edges so that tree falls apart! Pl

OSX: 解决10.10 Yosemite Developer Preview 2安装后的Recovery HD看不见的问题

OS X 10.10 Yosemite Developer Preview 2,下面简称10.10DP2,安装之后,有可能出现10.10的恢复盘(Recovery HD)看不见的问题.这是因为它的一个设置错误,下面我们用比较直观的方法来解决它. 这是修复后的启动选项,其中显示的Recovery-10.10 清楚点的 首先,开启磁盘工具的Debug菜单. 无论是从哪个磁盘启动,都可以操作,运行下面命令: defaults write com.apple.DiskUtility DUDebugMen

Radeon HD 7850 vs Radeon R9 270X

Radeon HD 7850 vs Radeon R9 270X HW compare Intro The Radeon HD 7850 comes with a GPU core speed of 860 MHz, and the 2048 MB of GDDR5 RAM runs at 1200 MHz through a 256-bit bus. It also is made up of 1024 SPUs, 64 Texture Address Units, and 32 Raster

JWPlayer支持SD/HD

First, we have to render two versions of our video: an SD (standard definition) and HD (high definition) one. Since the newer iPads, iPhones and Androids all play 720p video, let’s use that as the HD version. Full HD (1080p) is still a bit overkill,

电影TS/TC/SCR/R5/BD/HD版本意思收集(转)

一.版本说明: 1.CAM(枪版) CAM通常是用数码摄像机从电影院盗录.有时会使用小三角架,但大多数时候不可能使用,所以摄像机会抖动.因此我们看到画面通常偏暗人物常常会失真,下方的 字幕时常会出现倾斜. 由于声音是从摄像机自带的话筒录制,所以经常会录到观众的笑声等声音.因为这些因素,图象和声音质量通常都很差. 2.TS(准枪版) TS是TELESYNC的缩写.TS与CAM版的标准是相同的.但它使用的是外置音源(一般是影院座椅上为听力不好的人设的耳机孔)这个音源不能保证是好的音源,因为受到很多背

千里之堤毁于蚁穴(慎用HD Wallets)

转自:http://blog.sina.com.cn/s/blog_12ce70a430102vbu9.html -- 随机系列谈之四 现在我们都该明白,无论怎样强调随机对于比特币的重要性都不为过,随机的确称得上是比特币的“命根子”.在过去的几篇文章中,小太已经介绍过了一些因随机问题可能导致私钥暴漏的情况,今天,我再跟大家聊聊分层确定性(Hierarchical Deterministic)钱包. HD Wallets因其“只需要一个主(根)私钥,就能生成海量子私钥”这个特性广受欢迎,在过去的一

Intel HD Graphics 620 (华硕FL5900U) Windows7下安装显卡驱动

我们的牙膏大厂Intel,不但会挤牙膏,现在连驱动也不给你用了.KabyLake也就是第七代酷睿处理器,集成了Intel HD Graphics 620核显,核显(显卡)驱动程序只支持到Win10这一个系统,之前的Win8,Win8.1,Win7等,统统不支持.而华硕的FL5900U这款笔记本,就使用I7-7500U,刚好是第七代酷睿,集成了620核显. 还好伟大的YouTube上有人发出了如何在Win7下安装驱动的方法,具体如下: 下载Zip格式的驱动,解压缩,找到Graphics文件夹,找到

OSX: 命令行制作U盘Recovery HD

使用命令行操作,非常easy,可是操作不当非常危急! 免责声明:假设操作不当造成的数据丢失,本人概不负责. 为什么? 不是有OSX恢复磁盘助理嘛?是的.假设仅仅想使用GUI的软件.能够去苹果官方站点:http://support.apple.com/kb/DL1433?viewlocale=zh_CN 唯一的原因就是:生命不息,折腾不止:只是还有另外一个诱因,就是看看究竟官方的恢复磁盘助理的原理,换句话说,用自己的办法达到相同的效果. 前提:你有一个工作的Recovery HD,你的Mac支持U