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. iOS开发-表视图的使用

    // // ViewController.m // Simple Table // // Created by Jierism on 16/7/20. // Copyright © 2016年 Jie ...

  2. 【IOS界面布局】横竖屏切换和控件自适应(推荐)

    [IOS界面布局]横竖屏切换和控件自适应(推荐) 分类: [MAC/IOS下开发]2013-11-06 15:14 8798人阅读 评论(0) 收藏 举报 横竖屏切换 自适应 第一种:通过人为的办法改 ...

  3. C# 指针(unsafe与fixed的使用)

    c#在默认情况下生成的都是安全代码,即进行了代码托管(.NET的CLR机制好处之一是,进行代码托管,适时的释放内存,程序员便不必考虑资源的回收问题),而此时,指针不能出现在安全代码的编译条件下. 一. ...

  4. Requirements

    Requirements The framework requirements are limited. PHP 5.5 or greater. Apache Web Server or equiva ...

  5. C# 之 用NPOI类库操作Excel

    1.需引用以下命名空间: using NPOI.HSSF.UserModel; using NPOI.SS.UserModel; using NPOI.HPSF; using NPOI.HSSF.Ut ...

  6. 微信、微博、qq图标服务实现

    实现原理:变化前的图标和变化后的图标在一张图片上,用这张图片作为背景,通过定义背景的位置来实现显示哪个图标,其中还带着滑动的动画效果. <!DOCTYPE html> <html l ...

  7. [原]Eclipse 安装SVN、Maven插件(补充)

    参考雨之殇的文章:Eclipse 安装SVN.Maven插件 1.SVN可以按文章介绍的正常安装 2.Maven的Eclipse插件地址有变化 文章中的安装链接已经失效:m2e - http://m2 ...

  8. copy与deepcopy

    对于 数字 和 字符串 而言,赋值.浅拷贝和深拷贝无意义,因为其永远指向同一个内存地址. 对于字典.元祖.列表 而言,进行赋值.浅拷贝和深拷贝时,其内存地址的变化是不同的. 赋值,只是创建一个变量,该 ...

  9. 基于ubuntu和windows连接

    对于ubuntu和centos安装软件是不一样的 对于ubuntu是  apt-get install  +软件名字 但是对于centos是 yum install +软件名字 所以ubunu远程连接 ...

  10. JavaScript高级程序设计(第三版)学习笔记6、7章

    第6章,面向对象的程序设计 对象: 1.数据属性 configurable,表示能否通过delete删除属性从而重新定义属性,能否修改属性的特性,或能否把属性修改为访问器属性,默认为true ‚en ...