`
hellobin
  • 浏览: 62669 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

UVA 458 The Decoder

    博客分类:
  • UVA
 
阅读更多

The Decoder

Write a complete program that will correctly decode a set of characters into a valid message. Your program should read 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 manipulationof 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{pvu5
1PIT'pz'h'{yhklthyr'vm'{ol'Pu{lyuh{pvuhs'I|zpulzz'Thjopul'Jvywvyh{pvu5
1KLJ'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 same encoding scheme and should print the actual message of each set of characters.

 

Sample Input

 

1JKJ'pz'{ol'{yhklthyr'vm'{ol'Jvu{yvs'Kh{h'Jvywvyh{pvu5
1PIT'pz'h'{yhklthyr'vm'{ol'Pu{lyuh{pvuhs'I|zpulzz'Thjopul'Jvywvyh{pvu5
1KLJ'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.

#define RUN
#ifdef RUN

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <cctype> 
#include <algorithm>
#include <utility>
#include <math.h>

using namespace std;

#define MAXN 1000


int main(){


#ifndef ONLINE_JUDGE
	freopen("458.in", "r", stdin);
	freopen("458.out", "w", stdout); 
#endif

	
	char c;

	while(scanf("%c", &c) != EOF){
		if(c != '\n'){
			printf("%c", c-7);
		}
		else{
			printf("\n");
		}
	}

	return 0;

}


#endif

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics