(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, "START"))
12             {
13                 gets(text);
14                 int len=strlen(text),i;
15                 for(i=0;i<=len;i++)
16                 {
17                 if(text[i]>=‘F‘&&text[i]<=‘Z‘)
18                     text[i] = text[i] - 5;
19                 else if(text[i]>=‘A‘&&text[i]<=‘E‘)
20                     text[i] = text[i] + 21;
21                 }
22                 puts(text);
23             }
24             gets(text);
25         if (!strcmp(text, "END"))
26             continue;
27         else if (!strcmp(text, "ENDOFINPUT"));
28             break;
29         }
30         return 0;
31     }

时间: 2024-08-27 17:17:09

(HDU)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

让你改一改字符 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','

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 (g

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

HDU 1048 What Is Your Grade? (简单模拟)

 What Is Your Grade? Problem Description "Point, point, life of student!" This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points can you get? Now, I told you the rules which are used in

hdu 5293 Tree chain problem(树链剖分+树形dp)

题目链接:hdu 5293 Tree chain problem 维护dp[u], sum[u],dp[u]表示以u为根节点的子树的最优值.sum[u]表示以u节点的所有子节点的dp[v]之和.对于边a,b,w,在LCA(a,b)节点的时候进行考虑.dp[u] = min{dp[u], Sum(a,b) - Dp(a,b) + sum[u] | (ab链上的点,不包括u } #pragma comment(linker, "/STACK:1024000000,1024000000")

hdu 4267 A Simple Problem with Integers

题目链接:hdu 4267 A Simple Problem with Integers 类似于题目:hdu 1556 Color the ball 的技巧实现树状数组的段更新点查询. 由于该题对于段的更新并不是连续的,从而可以构造多个树状数组.因为$k \in [1,10] $,从而可以把更新划分为如下类型: 1,2,3,4,5... ------------- 1,3,5,7,9... 2,4,6,8,10... ------------- 1,4,7,10,13... 2,5,8,11,1