首页 > 其他 > 详细

UVa 11946 - Code Number

时间:2015-06-17 11:40:26      阅读:105      评论:0      收藏:0      [点我收藏+]

题目:两个小朋友写信让父母传递,为了不让父母看信里的内容,对信里面的内容加密,

            请对加密后的信解密。

分析:字符串,数论。只有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;
}


UVa 11946 - Code Number

原文:http://blog.csdn.net/mobius_strip/article/details/46530125

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!