HDOJ 1048 The Hardest Problem Ever

【题意】:很普通的解码问题,所有的大写字母左移5位。注意A-E的移动是加21,其他的减5。

【代码:AC】

#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cstdio>
using namespace std;

#define MAX 200+10
int main()
{
    char str[MAX];
    while (gets(str))
    {
        int i = 0;
        if (!strcmp(str, "START"))
        {
            gets(str);
            for (i = 0; i < strlen(str); i++)
                if (str[i] >= 'A' && str[i] <= 'Z')
                    {
                        if (str[i] <= 'E')
                            str[i] = str[i] + 21;
                        else
                            str[i] = str[i] - 5;
                    }
            puts(str);
        }
        gets(str);
        if (!strcmp(str, "END"))
            continue;
        else if (!strcmp(str, "ENDOFINPUT"));
            break;
    }
    return 0;
}
时间: 2024-08-05 10:59:23

HDOJ 1048 The Hardest Problem Ever的相关文章

JAVA HDU 1048 The Hardest Problem Ever

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1048 1 package hdu; 2 3 import java.io.BufferedInputStream; 4 import java.util.Scanner; 5 6 public class hdu_1048 { 7 8 public static void main(String[] args) { 9 Scanner in = new Scanner(new BufferedInp

HDU 1048.The Hardest Problem Ever【字符串处理】【8月25】

The Hardest Problem Ever 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 cip

(HDU)1048 --The Hardest Problem Ever( 最难的问题)

题目链:http://vjudge.net/problem/HDU-1048 其实就是一个密码变成明文的过程,找出规律就可以了. 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 6 int main() 7 { 8 char text[10000]; 9 while(gets(text)) 10 { 11 if (!strcmp(text, &

HDU 1048 - The Hardest Problem Ever

让你改一改字符 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 char s[105]; 6 const char list[]={'V','W','X','Y','Z','A','B','C','D','E','F','G' 7 ,'H','I','J','K','L','M','N','O','P','Q','R','S' 8 ,'T','

The Hardest Problem Ever(杭电1048)

/*The Hardest Problem Ever 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 c

(字符串 枚举)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 Problem Description Julius Caesa

HDOJ 1002 A + B Problem II (Big Numbers Addition)

题目链接在此?http://acm.hdu.edu.cn/showproblem.php?pid=1002 这题也比较简单,只需要开三个长度为1000的char数组来分别储存a.b.ans,再利用我们加法的算法,先向右对齐再相加.注意一下进位时的特殊情况就好了. 不过笔者的代码写好后提交上去,两次Presentation Error,然后才发现只是最后多输出一个空行的问题  =.= Orz /**  * HDOJ 1002 A + B Problem II  * Big Numbers Addi

HDOJ 5371 Hotaru&#39;s problem manacher+优先队列+二分

先用求回文串的Manacher算法,求出以第i个点和第i+1个点为中心的回文串长度,记录到数组c中 比如 10 9 8 8 9 10 10 9 8 我们通过运行Manacher求出第i个点和第i+1个点为中心的回文串长度 0 0 6 0 0 6 0 0 0 两个8为中心,10 9 8 8 9 10是个回文串,长度是6. 两个10为中心,8 9 10 10 9 8是个回文串,长度是6. 要满足题目所要求的内容,需要使得两个相邻的回文串,共享中间的一部分,比如上边的两个字符串,共享 8 9 10这一

HDU-1048-The Hardest Problem Ever(C++ &amp;&amp; 偶尔一水......)

The Hardest Problem Ever Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19343    Accepted Submission(s): 9061 Problem Description Julius Caesar lived in a time of danger and intrigue. The hard