UVa458 The Decoder
来源:互联网 发布:杭州淘宝拍摄基地tnt 编辑:程序博客网 时间:2024/05/26 09:55
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.
这题大意就是给定一串字符串,然后将其按照一定方法转换成另一个字符串,对比样例可以发现两串字符串之间差距是一定的,在给定字符串中对于每个字符都加上如'*'-'1'的值并输出即可。
#include <iostream>#include <cstdio>using namespace std;int main() {int d = '*' - '1';char s[100];while (gets(s)) {for (int i = 0; i < 100 && s[i]; i++)printf("%c",s[i]+d);cout << endl;}return 0;}
- UVa458 The Decoder
- The Decoder - UVa458
- UVA458 The Decoder
- UVA458 - The Decoder
- UVa458 - The Decoder-字符串-难度1
- uva458
- The Decoder
- The Decoder
- The Decoder
- Uva 458 - The Decoder
- UVa 458 - The Decoder
- 458 - The Decoder
- JOJ 1240 The Decoder
- 458 - The Decoder
- uva 458 The Decoder
- UVA 458 - The Decoder
- uva-458 - The Decoder
- 458 - The Decoder
- IE10成第二受欢迎的IE浏览器
- 使用BCDEdit命令修改VISTA/WIN7启动项
- 【代码阅读的方法与实践】第1章 导论
- google开源项目介绍
- Java基本数据类型
- UVa458 The Decoder
- 简单测试java里一个对象的初始化是按怎样的顺序执行的
- 检测到不兼容的键盘驱动程序该对话框已被停用!
- ASP.NET身份验证
- Qt5.1静态库使用
- HDU 3415 Max Sum of Max-K-sub-sequence【单调队列】
- 7月国内智能终端浏览器市场:安卓自带浏览器第一
- Linux的bg和fg命令
- sdsadasdsad