1.链接地址:

http://poj.org/problem?id=2141

http://bailian.openjudge.cn/practice/2141/

2.题目:

Message Decowding
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 11784   Accepted: 6562

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

Source

3.思路:

4.代码:

 #include<iostream>
#include<cstring>
#include <cstdio> using namespace std;
char c[];
int main()
{
int i;
char a[];
int size;
for(i=;i<;i++) cin>>c[i];
getchar();
gets(a);
size=strlen(a);
for(i=;i<size;i++)
{
if(a[i]==' ') cout<<a[i];
else if(a[i]>='A'&&a[i]<='Z') cout<<(char)(c[a[i]-'A']-'a'+'A');
else cout<<(c[a[i]-'a']);
}
cout<<endl;
//system("pause");
return ;
}

OpenJudge / Poj 2141 Message Decowding的更多相关文章

  1. POJ - 2041Unreliable Message

    这里的算法非常简单,就是“模拟”,注意编写每个传令官的算法时先分开测试,放在一起就会混淆. POJ - 2041Unreliable Message Time Limit: 1000MS Memory ...

  2. hdu 2716 Message Decowding

    Message Decowding Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  3. OpenJudge/Poj 1936 All in All

    1.链接地址: http://poj.org/problem?id=1936 http://bailian.openjudge.cn/practice/1936 2.题目: All in All Ti ...

  4. OpenJudge/Poj 1125 Stockbroker Grapevine

    1.链接地址: http://poj.org/problem?id=1125 http://bailian.openjudge.cn/practice/1125 2.题目: Stockbroker G ...

  5. OpenJudge / Poj 1044 Date bugs C++

    链接地址: Poj:http://poj.org/problem?id=1044 OpenJudge:http://bailian.openjudge.cn/practice/1044/ 题目: 总时 ...

  6. OpenJudge/Poj 2105 IP Address

    1.链接地址: http://poj.org/problem?id=2105 http://bailian.openjudge.cn/practice/2105 2.题目: IP Address Ti ...

  7. OpenJudge/Poj 2027 No Brainer

    1.链接地址: http://bailian.openjudge.cn/practice/2027 http://poj.org/problem?id=2027 2.题目: 总Time Limit: ...

  8. OpenJudge/Poj 2013 Symmetric Order

    1.链接地址: http://bailian.openjudge.cn/practice/2013 http://poj.org/problem?id=2013 2.题目: Symmetric Ord ...

  9. OpenJudge/Poj 1088 滑雪

    1.链接地址: bailian.openjudge.cn/practice/1088 http://poj.org/problem?id=1088 2.题目: 总Time Limit: 1000ms ...

随机推荐

  1. 2015北京网络赛 A题 The Cats' Feeding Spots 暴力

    The Cats' Feeding Spots Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://hihocoder.com/contest/acm ...

  2. zookeeper配置同步zookeeper编程

    分布式助手Zookeeper(四) kissyoudyb 2013-12-05 17:41 阅读:33 评论:0     分布式助手Zookeeper(三) kissyoudyb 2013-12-05 ...

  3. uboot中gd的定义和使用

    近期在做uboot中nand启动相关的工作,遇到一个问题一直纠结着.如今最终明确了这个问题,想想还有好多兄弟在某个黑暗的角落里或者某台电脑前纠结着呢,所以赶紧写下来以供查阅. uboot versio ...

  4. careercup-C和C++ 13.8

    13.8 编写一个智能指针类.智能指针是一种数据类型,一般用模板实现,模拟指针行为的同时还提供自动垃圾回收机制.它会自动记录SmartPointer<T*>对象的引用计数,一旦T类型对象的 ...

  5. PHP中的全局变量$_SERVER

    1.常用 $_SERVER['PHP_SELF'] #当前正在执行脚本的文件名,与 document root相关.$_SERVER['argv'] #传递给该脚本的参数.$_SERVER['argc ...

  6. eclipse中不能找到dubbo.xsd解决方法

    使用dubbo时遇到问题: org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'htt ...

  7. Asp.Net 之 未能加载文件或程序集 system.web.extensions 解决方法

    最近做项目发现未能加载文件或程序集的错误,这是由于我的机器上没有安装Ajax的原因.问题解决后,整理如下:表现:1."System.Web.Extensions, Version=1.0.61025. ...

  8. Tomcat启动报错org.apache.coyote.AbstractProtocol.init Failed to initialize end point associated with ProtocolHandler ["http-apr-8080"]”

    1.使用netstat查看端口8080的使用情况: netstat -ano | findstr 8080 结果为: 最后一列表示使用8080端口的进程PID,如果返回结果为空则说明没有被使用. 2. ...

  9. windows下mysql初始密码设置

    转载自:http://blog.csdn.net/ofreelander/article/details/50802780 1.my-default.ini 改名my.ini 在解压的目录下面复制my ...

  10. Linux Shell产生16进制随机数

    n为字符长度 openssl rand -hex n