程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> HDOJ 4690 EBCDIC 模擬

HDOJ 4690 EBCDIC 模擬

編輯:C++入門知識

HDOJ 4690 EBCDIC 模擬



把圖片用ORC轉化成文字,用vim錄個宏很容易就可以字母們格式化.....

EBCDIC

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


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.
\

Here is the ASCII table.
\


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 2013 Multi-University Training Contest 9


#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;

map mp;

string EBCDIC[10000]=
{"NUL","SOH","STX","ETX","  ","HT","  ","DEL","  ","  ","  ","VT","FF","CR","SO","SI",
"DLE","DC1","DC2","DC3","  ","  ","BS","  ","CAN","EM","  ","  ","IFS","IGS","IRS","IUS ITB",
"  ","  ","  ","  ","  ","LF","ETB","ESC","  ","  ","  ","  ","  ","ENQ","ACK","BEL",
"  ","  ","SYN","  ","  ","  ","  ","EOT","  ","  ","  ","  ","DC4","NAK","  ","SUB",
"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","  ","  ","  ","  ","  ","  ",
"0","1","2","3","4","5","6","7","8","9","  ","  ","  ","  ","  ","  "};

string ASC[10000]=
{
"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","!","\"","#","$","%","&","'","(",")","*","+",",","-",".","/",
"0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?",
"@","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"
};

void init()
{
    for(int i=0;i<8;i++)
    {
        for(int j=0;j<16;j++)
        {
            mp[ASC[i*16+j]]=i*16+j;
        }
    }
}

int num(char c)
{
    if(c>='0'&&c<='9')
        return c-'0';
    return c-'A'+10;
}

char CHAR(int x)
{
    if(x<=9) return x+'0';
    return x-10+'A';
}

int main()
{
    string READ;
    init();
    while(cin>>READ)
    {
        for(int i=0,sz=READ.size();i


  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved