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 sprite触摸处理
转自:http://www.cnblogs.com/lancidie/archive/2013/04/01/2993890.html 我们常常需要判断用户的点击操作是否落于某个sprite之上,进而让 ...
- Android Error
[2016-03-27 13:00:51 - XWeChat] Dx warning: Ignoring InnerClasses attribute for an anonymous inner c ...
- 【转】linux中的sed命令
转自:http://www.cnblogs.com/shineshqw/articles/1978122.html 功能说明: 利用script来处理文本文件. 语 法:sed [-hnV][-e&l ...
- SQLyog破解版:SQLyog MySQL GUI 11.2.4-0 Ultimate中文版 带序列号【转载】
SQLyog 是一个易于使用的.快速而简洁的图形化管理MYSQL数据库的工具,目前(2013年9月11日)最新版为:SQLyog Ultimate – MySQL GUI v11.24,本站已亲测比较 ...
- Redis的Time Event与File Event的微妙关系
redis里设计了两类事件,一类是file event,一类是time event. 其中file event主要为网络事件而设计,而time event为一些后台事件设计. 在两类事件的管理设计上, ...
- Nginx与Tomcat、Client之间请求的长连接配置不一致问题解决[转]
http://bert82503.iteye.com/blog/2152613 前些天,线上出现“服务端长连接与客户端短连接引起Nginx的Writing.Active连接数过高问题”,这个是由于“服 ...
- css Hack,用IE11模拟测试的,条件注释要找真IE去测,模拟的无效
<!DOCTYPE html> <!--[if lt IE 7 ]> <html class="ie6 ie"> <![endif]--& ...
- 学习笔记之#pragma
http://baike.baidu.com/link?url=lxA9Wl1KnacWUDZYz5U06iKMkUAeI6dr0x1wQ4i-rqf6Dpk6hEeOOaj2XhvGx9VLVm2z ...
- sql根据表名获取字段及对应说明
SELECT TableName = OBJECT_NAME(c.object_id), ColumnsName = c.name, Description = ex.value, ColumnTyp ...
- C#连接SQL SERVER数据库的详细步骤!
首先,在SQL SEVER里建立一个名为“Exercise”的数据库名,在该数据库下建立一张名为“lianxi”的表.好,现在开始写代码. 在FORM1里拖一个DATAGIRDVIEW用于显示表, ...