码迷,mamicode.com
首页 > 其他好文 > 详细

UVa 11946 - Code Number

时间:2015-06-17 11:42:45      阅读:306      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!