POJ-2141 Message Decowding-奶牛密碼
Message Decowding
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 12242 | Accepted: 6844 |
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:
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.
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
* 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
USACO 2003 March Orange
getchar()每次用的時候都覺得好危險。。可能自己還是掌握的不夠好
/*
*Copyright (c)2015,煙臺大學計算機與控制工程學院
*All rights reserved.
*作 者:單昕昕
*完成日期:2015年8月22日
*版 本 號:v1.0
*/
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
char k[26],c;
int i;
for(i=0; i<26; ++i)
cin>>k[i];
getchar();
while((c=getchar()))//用cin不能接受到空格
{
if(c>='A'&&c<='Z')
cout<<char(k[c-'A']-'a'+'A');
else if(c>='a'&&c<='z')
cout<<k[c-'a'];
else if(c=='\n')
break;
else
cout<<c;
}
return 0;
}
getchar()每次用的時候都覺得好危險。。可能自己還是掌握的不夠好
相關文章
- Message(Message Pool)原始碼分析原始碼
- android原始碼解析--MessageAndroid原始碼
- 希爾密碼(hill密碼)密碼
- 密碼安全:密碼設定要求,密碼爆破辦法,密碼歸類使用,密碼處置方案密碼
- mysql學習之-密碼管理(預設密碼,修改密碼,解決忘記密碼)MySql密碼
- 序列密碼與分組密碼密碼
- U盾密碼密碼重置方法密碼
- 隱藏密碼?顯示密碼?密碼
- 應用密碼學——古典密碼密碼學
- 密碼密碼
- 【密碼】Oracle使用者密碼系列密碼Oracle
- mysql 忘記密碼,mysql修改密碼MySql密碼
- ubuntu root預設密碼(初始密碼)Ubuntu密碼
- 關於密碼檔案,SYS密碼密碼
- 應用密碼學 - 公鑰密碼密碼學
- 應用密碼學——分組密碼密碼學
- 現代密碼-公鑰密碼RSA密碼
- 密碼指令碼密碼指令碼
- 《密碼學系列》|| 密碼學中的流密碼是怎麼回事?密碼學
- 費納姆密碼-二進位制密碼密碼
- MYSQL修改密碼和忘記ROOT密碼MySql密碼
- 3122 奶牛代理商 VIII
- 拆分密碼密碼
- 移位密碼密碼
- 替代密碼密碼
- 密碼抓取密碼
- 密碼學密碼學
- 密碼生成密碼
- 分組密碼(一) — 密碼學複習(四)密碼學
- PDF密碼忘記了,如何找回口令密碼密碼
- 群暉NAS忘記密碼如何重置密碼密碼
- 淺議密碼強度與密碼破解(2)密碼
- PbootCMS忘記密碼後的重置密碼流程boot密碼
- 在 Linux 命令列上擁有一頭奶牛Linux命令列
- COW奶牛!CopyOnWrite機制瞭解一下
- 認養一頭牛IPO:奶牛為誰而養?
- win10密碼忘記怎麼清除密碼 win10重置開機密碼Win10密碼
- PbootCMS後臺登陸密碼忘記/找回密碼後臺登入密碼外掛boot密碼