EBCDIC

Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 102400/102400 K (Java/Others)
Total Submission(s): 160    Accepted Submission(s): 81

Problem Description
A mad scientist found an ancient message from an obsolete IBN System/360 mainframe. He believes that this message contains some very important secret about the Stein's Windows Project. The IBN System/360 mainframe uses Extended Binary Coded Decimal Interchange Code (EBCDIC). But his Artificial Intelligence Personal Computer (AIPC) only supports American Standard Code for Information Interchange (ASCII). To read the message, the mad scientist ask you, his assistant, to convert it from EBCDIC to ASCII.
Here is the EBCDIC table.
HDU 4690 EBCDIC (2013多校 1005题   胡搞题)-LMLPHP      
Here is the ASCII table.
HDU 4690 EBCDIC (2013多校 1005题   胡搞题)-LMLPHP
 
Input
The input of this problem is a line of uppercase hexadecimal string of even length. Every two hexadecimal digits stands for a character in EBCDIC, for example, "88" stands for 'h'.
 
Output
Convert the input from EBCDIC to ASCII, and output it in the same format as the input.
 
Sample Input
C59340D7A2A840C3969587999696
 
Sample Output
456C2050737920436F6E67726F6F

Hint

E.html download 方便图中文字复制
http://pan.baidu.com/share/link?shareid=453447595&uk=352484775

 
Author
Zejun Wu (watashi)
 
Source
 
Recommend
zhuyuanchen520
 

这题胡搞就行了。

把上面的和下面的表都复制下来。  注意上面的空的要找个东西代替。

在记事本下很容易修改了。查找替换啥的,再手动修改下格式

 /* ***********************************************
Author :kuangbin
Created Time :2013/8/20 13:11:33
File Name :F:\2013ACM练习\2013多校9\1005.cpp
************************************************ */ #include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
string str[] =
{
"NUL","SOH","STX","ETX","XXXXXXX","HT","XXXXXXX","DEL","XXXXXXX","XXXXXXX","XXXXXXX","VT","FF","CR","SO","SI",
"DLE","DC1","DC2","DC3","XXXXXXX","XXXXXXX","BS","XXXXXXX","CAN","EM","XXXXXXX","XXXXXXX","IFS","IGS","IRS","IUS ITB",
"XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","LF","ETB","ESC","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","ENQ","ACK","BEL",
"XXXXXXX","XXXXXXX","SYN","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","EOT","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","DC4","NAK","XXXXXXX","SUB",
"SP","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX",".","<","(","+","|",
"&","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","!","$","*",")",";","XXXXXXX",
"-","/","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX",",","%","_",">","?",
"XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","`",":","#","@","\'","=","\"",
"XXXXXXX","a","b","c","d","e","f","g","h","i","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX",
"XXXXXXX","j","k","l","m","n","o","p","q","r","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX",
"XXXXXXX","~","s","t","u","v","w","x","y","z","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX",
"^","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","[","]","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX",
"{","A","B","C","D","E","F","G","H","I","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX",
"}","J","K","L","M","N","O","P","Q","R","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX",
"\\","XXXXXXX","S","T","U","V","W","X","Y","Z","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX",
"","","","","","","","","","","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX","XXXXXXX"
};
string str2[]=
{
"NUL","SOH","STX","ETX","EOT","ENQ","ACK","BEL","BS","HT","LF","VT","FF","CR","SO","SI",
"DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB","CAN","EM","SUB","ESC","IFS","IGS","IRS","IUS ITB",
"SP","!","\"","#","$","%","&","\'","(",")","*","+",",","-",".","/",
"","","","","","","","","","",":",";","<","=",">","?",
"@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O",
"P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","^","_",
"`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o",
"p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","DEL"
};
char s[];
int change(char ch)
{
if(ch <='')return ch-'';
else return ch-'A'+;
}
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
while(scanf("%s",s)==)
{
int n = strlen(s);
for(int i = ;i < n;i+=)
{
int p = change(s[i])* + change(s[i+]);
int t = ;
while(t < && str2[t] != str[p])t++;
printf("%02X",t);
}
printf("\n");
}
return ;
}
04-17 15:09