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 ...
随机推荐
- iOS开发-在表单元中添加子视图
#import <UIKit/UIKit.h> @interface NameAndColorCellTableViewCell : UITableViewCell @property(c ...
- 在ubuntu上面配置nginx实现反向代理
1.下载nginx 官网:http://nginx.org/en/download.html 直接在服务器上下载 wget http://nginx.org/download/nginx- ...
- 【转】MyEclipse8.5集成Tomcat7时的启动错误:Exception in thread “main” java.lang.NoClassDefFoundError org/apache/commons/logging/LogFactory
http://www.cnblogs.com/newsouls/p/4021198.html 今天,安装Tomcat7.0.21后,单独用D:\apache-tomcat-7.0.21\bin\sta ...
- SCOM2012端口需求
Agent push requirements (including firewall ports): The account being used to push the agent must ha ...
- 简单详细的OD破解教程
2007-08-04 15:46作者:CCDebuger注:昨天在网上见到了这篇文章,但缺少插图,从另外一篇文章中也看到了类似的的教程文章,里面的插图质量实在不敢恭维.在一个论坛中正好下载了文章中所介 ...
- iOS开发——新特性Swift篇&Swift 2.0 异常处理
Swift 2.0 异常处理 WWDC 2015 宣布了新的 Swift 2.0. 这次重大更新给 Swift 提供了新的异常处理方法.这篇文章会主要围绕这个方面进行讨论. 如何建造异常类型? 在 i ...
- sql server char nchar nvarchar varchar之間的區別
char存储固定长度的字符串,最大长度为8000个字节. varchar存储可变长度的字符串.最大长度为8000个字节. nchar存储固定长度的Unicode字符串,最大长度为4000个字符. nv ...
- tar备份系统的方法
下面是备份系统的方法: 然后打开终端,输入以下命令: 1.成为根用户: sudo su 2.转到根目录: cd / 然後,下面就是我用来备份我的系统的完整的命令:tar -cvpzf /med ...
- Linux系统常用命令 __转载的
1.登录linux系统命令:login 用户名 密码: 2.注销linux系统命令:logout ; 3.在linux系统中进入windows系统(图形界面)命令:Start x; 4.关闭lin ...
- VS2012 编译GDAL
先安装VS 2012, 然后下载GDAL最新版本代码,解压. 用管理员权限打开Developer Command Prompt for VS2012终端,进入代码目录. 然后运行命令: nmake / ...