【转】http://hi.baidu.com/sunkehappy/blog/item/c1a400cafe94294cf21fe7a6.html
/* 字符串简单题
* 2009-09-24 16:28:42 Accepted 1831 C++ 0 184 祝你好运!
* 里面有比较诡异的地方,大概是原码和密码中有空格对应关系,
* 所以必须用getline或者gets之类的读取整行的函数读取,不然会WA 。
*/
#include <iostream>
#include <map>
#define DEBUG 1
using namespace std ;
map<char,char> cypher ;
int main()
{
#if DEBUG
freopen("C:\\Documents and Settings\\Administrator\\桌面\\in.txt","r",stdin) ;
freopen("C:\\Documents and Settings\\Administrator\\桌面\\out.txt","w",stdout) ;
#endif
char ch ;
int i ;
string from, to ;
getline( cin, from ) ;
getline( cin, to ) ;
cout << to << endl << from << endl ;
for( i=0; i<from.size(); ++i ){
cypher[ from[i] ] = to[i] ;
}
while( EOF != scanf("%c", &ch ) ){
if( cypher.count( ch ) )
printf("%c", cypher[ch] ) ;
else
printf("%c", ch ) ;
}
return 0 ;
}
分享到:
相关推荐
训练时发现的好题目。#include #include int main() { char ch; char str[100]; while(gets(str)) { if(str[0] == 'E') return 0; int z = 0, o = 0, j = 0, i = 0; while(str[i] !...}
Substitution cipher is defined by a substitution table assigning each character of the substitution alphabet another character of the same alphabet. The assignment is a bijection (to each character ...
ZOJ解题报告ZOJ解题报告ZOJ解题报告ZOJ解题报告
zoj题目简单归类zoj题目简单归类zoj题目简单归类
acm中zoj1002的可运行C++程序
包含了zoj700多道题目的源代码,在做题时可以参考
Problem Arrangement zoj 3777
ZOJ题目答案源码
学习ACM程序设计的朋友一定要看,这是训练必备的POJ ZOJ题目分类及解题思路
一个非常非常非常非常实用的zoj结题代码
zoj 1003 c语言的,要写这么多描述吗。。
浙大ZOJ题目分类,可以让你更方便快速锁定那你想要联系的题目,是自己快速提高·
本代码是zoj上AC的1951的代码,把双重循环简化为O(n),不过素数判断的改进还不够
ZOJ1805代码
zoj1027解题指南和代码,还不错,是学校培训给的。
ZOJ题解集合-截至2835。共1244个文件,C/C++,有重复
zoj 题库 详细解答 解题代码 acm
zoj4041正确题解源代码,以及运行程序
zoj吐血制作,希望大家喜欢
大学ACM竞赛,ZOJ 1733 运用递归(优化)的方法。ac的代码。