OpenJudge / Poj 2141 Message Decowding
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:
yrwhsoujgcxqbativndfezmlpkWhich 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 xtfgrjSample Output
Jump the fence when you seeing me comingSource
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的更多相关文章
- POJ - 2041Unreliable Message
这里的算法非常简单,就是“模拟”,注意编写每个传令官的算法时先分开测试,放在一起就会混淆. POJ - 2041Unreliable Message Time Limit: 1000MS Memory ...
- hdu 2716 Message Decowding
Message Decowding Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others ...
- OpenJudge/Poj 1936 All in All
1.链接地址: http://poj.org/problem?id=1936 http://bailian.openjudge.cn/practice/1936 2.题目: All in All Ti ...
- OpenJudge/Poj 1125 Stockbroker Grapevine
1.链接地址: http://poj.org/problem?id=1125 http://bailian.openjudge.cn/practice/1125 2.题目: Stockbroker G ...
- OpenJudge / Poj 1044 Date bugs C++
链接地址: Poj:http://poj.org/problem?id=1044 OpenJudge:http://bailian.openjudge.cn/practice/1044/ 题目: 总时 ...
- OpenJudge/Poj 2105 IP Address
1.链接地址: http://poj.org/problem?id=2105 http://bailian.openjudge.cn/practice/2105 2.题目: IP Address Ti ...
- OpenJudge/Poj 2027 No Brainer
1.链接地址: http://bailian.openjudge.cn/practice/2027 http://poj.org/problem?id=2027 2.题目: 总Time Limit: ...
- OpenJudge/Poj 2013 Symmetric Order
1.链接地址: http://bailian.openjudge.cn/practice/2013 http://poj.org/problem?id=2013 2.题目: Symmetric Ord ...
- OpenJudge/Poj 1088 滑雪
1.链接地址: bailian.openjudge.cn/practice/1088 http://poj.org/problem?id=1088 2.题目: 总Time Limit: 1000ms ...
随机推荐
- cocos2d-x 判断系统语言
转自:http://blog.csdn.net/tangaowen/article/details/8878193 //default language is local language ccLan ...
- cocos2d-x Action
转自:http://codingnow.cn/cocos2d-x/775.html 从结构图可以看出,动作类的基类是CCAction,通过继承它可以实现很多种动作. CCFiniteTimeActio ...
- MFC 学习 之 状态栏的添加
1.首先声明一个 CStatusBar m_bar;//声明对象2.然后打开视图资源 String Table中添加两个字段值 3.创建了两个字段值以后,在OnintDialog() 所在的 .cp ...
- HDU 5478 Can you find it 随机化 数学
Can you find it Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pi ...
- 什么是集群(cluster)
1.集群 1.1 什么是集群 简单的说,集群(cluster)就是一组计算机,它们作为一个总体向用户提供一组网络资源.这些单个的计算机系统就是集群的节点(node).一个理想的集群是,用户从来不会意识 ...
- [RxJS] Subject basic
A Subject is a type that implements both Observer and Observable types. As an Observer, it can subsc ...
- JavaScript,Java,php的区分大小写问题
JavaScript 对大小写敏感. JavaScript 对大小写是敏感的.JavaScript属于弱类型语言 当编写 JavaScript 语句时,请留意是否关闭大小写切换键. 函数 getEle ...
- Best Practice of cross-platform games
__super keyword this keyworld is offered only by Microsoft VC. So you had to call the very name of p ...
- GCC生成的汇编代码
假设我们写了一个C代码文件 code.c包含下面代码: int accum = 0; int sum(int x, int y){ int t = x + y; accum += t; return ...
- JavaScript学习总结二(Date对象的用法)
javascript Date对象的常用API 1:创建日期 Date 对象用于处理日期和时间. 可以通过 new 关键词来定义 Date 对象.以下代码定义了名为 myDate 的 Date 对象: ...