Message Decowding

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 999    Accepted Submission(s): 468

Problem Description
The cows are thrilled because they've just learned about encrypting messages. They think they will be able to use secret messages to plot meetings with cows on other farms.

Cows are not known for their intelligence. Their encryption method is nothing like DES or BlowFish or any of those really good secret coding methods. No, they are using a simple substitution cipher.

The cows have a decryption key and a secret message. Help them decode it. The key looks like this:

yrwhsoujgcxqbativndfezmlpk

Which means that an 'a' in the secret message really means 'y'; a 'b' in the secret message really means 'r'; a 'c' decrypts to 'w'; and so on. Blanks are not encrypted; they are simply kept in place.

Input text is in upper or lower case, both decrypt using the same decryption key, keeping the appropriate case, of course.

 
Input
* Line 1: 26 lower case characters representing the decryption key

* Line 2: As many as 80 characters that are the message to be decoded

 
Output
* Line 1: A single line that is the decoded message. It should have the same length as the second line of input.
 
Sample Input
eydbkmiqugjxlvtzpnwohracsf
Kifq oua zarxa suar bti yaagrj fa xtfgrj
 
Sample Output
Jump the fence when you seeing me coming
 
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define MAX 1000
using namespace std;
int main()
{
char s[MAX];
char c;
while(scanf("%s",s)!=EOF)
{
getchar();
while(scanf("%c",&c)&&c!='\n')
{
if(c!=' ')
{
if(c>='A'&&c<='Z')
printf("%c",s[c-'A']-32);
else if(c>='a'&&c<='z')
printf("%c",s[c-'a']);
}
else
printf(" ");
}
printf("\n");
}
return 0;
}

  

hdu 2716 Message Decowding的更多相关文章

  1. OpenJudge / Poj 2141 Message Decowding

    1.链接地址: http://poj.org/problem?id=2141 http://bailian.openjudge.cn/practice/2141/ 2.题目: Message Deco ...

  2. hdu 4661 Message Passing(木DP&amp;组合数学)

    Message Passing Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Other ...

  3. HDU 4661 Message Passing 【Tree】

    题意: 给一棵树,每一个结点都有一个信息,每一个时刻,某一对相邻的结点之间可以传递信息,那么存在一个最少的时间,使得所有的节点都可以拥有所有的信息.但是,题目不是求最短时间,而是求最短时间的情况下,有 ...

  4. HDU 4661 Message Passing ( 树DP + 推公式 )

    参考了: http://www.cnblogs.com/zhsl/archive/2013/08/10/3250755.html http://blog.csdn.net/chaobaimingtia ...

  5. 【 2013 Multi-University Training Contest 6 】

    HDU 4655 Cut Pieces 假设n个数构成的总数都分成了n段,总数是n*a1*a2*...*an.但是答案显然不会那么多. 对于相邻的两个ai,ai+1,如果选择相同的颜色,那么就减少了a ...

  6. 算法之路 level 01 problem set

    2992.357000 1000 A+B Problem1214.840000 1002 487-32791070.603000 1004 Financial Management880.192000 ...

  7. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  8. Spring DI

    一.   Spring DI 依赖注入 利用spring IOC实例化了对象,而DI将实例化的对象注入到需要对象的地方,完成初始化任务. 对象由spring创建,之后再由spring给属性赋值 spr ...

  9. Eclipse 4.2 failed to start after TEE is installed

    ---------------  VM Arguments---------------  jvm_args: -Dosgi.requiredJavaVersion=1.6 -Dhelp.lucene ...

随机推荐

  1. linux命令中 rpm –qa|grep softname的含义

    rpm –qa是列出所有rpm包后面接管道 |grep softname就是查含有softname的包名

  2. Pig安装及简单使用(pig版本0.13.0,Hadoop版本2.5.0)

    原文地址:http://www.linuxidc.com/Linux/2014-03/99055.htm 我们用MapReduce进行数据分析.当业务比较复杂的时候,使用MapReduce将会是一个很 ...

  3. MySQL高效分页解决方案集

    一,最常见MYSQL最基本的分页方式: select * from content order by id desc limit 0, 10 在中小数据量的情况下,这样的SQL足够用了,唯一需要注意的 ...

  4. Android数据存储(三)——SQLite

    如果需要一个更加健壮的数据存储机制,则需要使用一个关系型数据库,在Android上,则为SQLlite. SQLite的特点:轻量级.嵌入式的.关系型数据库.可移植性好,易使用,小,高效且可靠,与使用 ...

  5. struts采用JavaServlet/JSP技术,实现了基于Java EEWeb应用的MVC设计模式的应用框架

    今天我用Ecipse搭建Struts框架,并且使用Struts框架编写一个最简单的例子,相信读者能够很容易的明白. Struts是当今Java比较流行的三大框架之一,三大框架是Struts,sprin ...

  6. 2013ACM省赛题目

    地址就贴这一个吧 都在附近 当时回来也没做做 一伤心了 二是当时实在太弱了 先补两道DP E题的区间DP dp[i][j]  截止到i位置以字母j为结束的上升序列 正序 逆序各来一遍 再循环一遍保存一 ...

  7. android 自动调整屏幕分辨率

    请看 http://blog.csdn.net/awp258/article/details/7593340

  8. DTD约束文件

    在讲解DTD文件之前,我要说说一份合格的XML应该符合怎么样的规则? 就我总结一下几点,大家看看就好了: 1.一份XML有且仅有一个根元素. 2.XML是严格区分大小写的,<book>元素 ...

  9. Warning: Name is nonexistent or not a directory

    Every time I start up MATLAB, I receive this message: Warning: Name is nonexistent or not a director ...

  10. Spring--通过注解来配置bean

    Spring通过注解配置bean 基于注解配置bean 基于注解来配置bean的属性 在classpath中扫描组件 组件扫描(component scanning):Spring能够从classpa ...