标签:
题目:两个小朋友写信让父母传递,为了不让父母看信里的内容,对信里面的内容加密,
请对加密后的信解密。
分析:字符串,数论。只有10个字母被选择称为0~9的映射,直接转化即可。
说明:╮(╯▽╰)╭UVa又打不开了╮(╯▽╰)╭。
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
char buf[81];
char map[11] = "OIZEASGTBP";
int main()
{
int T;
while (~scanf("%d",&T)) {
getchar();
while (T --) {
while (gets(buf) && buf[0]) {
for (int i = 0; buf[i]; ++ i)
if (buf[i] >= '0' && buf[i] <= '9')
buf[i] = map[buf[i]-'0'];
puts(buf);
}
if (T) printf("\n");
}
}
return 0;
}
标签:
原文地址:http://blog.csdn.net/mobius_strip/article/details/46530125