458 - The Decoder
来源:互联网 发布:托福英语辅导机构知乎 编辑:程序博客网 时间:2024/05/19 06:39
The Decoder
Write a complete program that will correctly decode a set ofcharacters into a valid message. Your program shouldread a given file of a simple coded set of characters and print the exact message that the characters contain. The code key for this simple coding is a one for one character substitution based upon asingle arithmetic manipulation of the printable portion of the ASCII character set.
Input and Output
For example: with the input file that contains:
1JKJ'pz'{ol'{yhklthyr'vm'{ol'Jvu{yvs'Kh{h'Jvywvyh{pvu51PIT'pz'h'{yhklthyr'vm'{ol'Pu{lyuh{pvuhs'I|zpulzz'Thjopul'Jvywvyh{pvu51KLJ'pz'{ol'{yhklthyr'vm'{ol'Kpnp{hs'Lx|pwtlu{'Jvywvyh{pvu5
your program should print the message:
*CDC is the trademark of the Control Data Corporation.*IBM is a trademark of the International Business Machine Corporation.*DEC is the trademark of the Digital Equipment Corporation.
Your program should accept all sets of characters that use the sameencoding scheme and should print the actual message of each set ofcharacters.
Sample Input
1JKJ'pz'{ol'{yhklthyr'vm'{ol'Jvu{yvs'Kh{h'Jvywvyh{pvu51PIT'pz'h'{yhklthyr'vm'{ol'Pu{lyuh{pvuhs'I|zpulzz'Thjopul'Jvywvyh{pvu51KLJ'pz'{ol'{yhklthyr'vm'{ol'Kpnp{hs'Lx|pwtlu{'Jvywvyh{pvu5
Sample Output
*CDC is the trademark of the Control Data Corporation.*IBM is a trademark of the International Business Machine Corporation.*DEC is the trademark of the Digital Equipment Corporation.
AC代码
#include <stdio.h>#include <string.h>#define MAXN 100+10int main(void){#ifdefTESTfreopen("data.in", "r", stdin);freopen("data.out", "w", stdout);#endifchar str[MAXN];int i, n;while(scanf("%s", str) != EOF) {n = strlen(str);for (i=0; i<n; ++i) str[i] -= 7;printf("%s\n", str);}return 0;}
- Uva 458 - The Decoder
- UVa 458 - The Decoder
- 458 - The Decoder
- 458 - The Decoder
- uva 458 The Decoder
- UVA 458 - The Decoder
- uva-458 - The Decoder
- 458 - The Decoder
- uva 458 The Decoder
- UVaOJ 458 - The Decoder
- 458 - The Decoder
- UVa 458 - The Decoder
- UVA 458 The Decoder
- 458 - The Decoder
- 458 - The Decoder
- 458 - The Decoder
- 458 - The Decoder
- UVA - 458 - The Decoder
- SQL Server 2005中的except/intersect和outer apply
- 求子数组的最大和
- Source Insight使用大全
- 优先级队列(可用堆实现)
- 使用coalesce和nullif的组合来减轻写sql的工作量
- 458 - The Decoder
- TMM和游戏(一)
- 生活随笔,人生态度决定生活质量
- COREBOOT + QEMU
- 正则表达式30分钟入门教程
- 关于struts2的namespace设置问题
- LINUX CENTOS下单网卡设置多个IP的方法(REDHAT)
- 正多边形的滚动与旋轮线下方的面积 (matrix67.com)
- netca 配置 local naming method报错-TNS-04605: Invalid syntax error: Unexpected char or LITERAL "(" befor