您的位置:首页 > 其它

UVa 11946 - Code Number

2015-06-17 09:43 549 查看
题目:两个小朋友写信让父母传递,为了不让父母看信里的内容,对信里面的内容加密,

请对加密后的信解密。

分析:字符串,数论。只有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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: