hdu4690 EBCDIC
2015-08-19 16:08
323 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4690
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
Sample Output
题意:
给你两个表,输入的是对应第一张表的坐标,求对应符合在第二张表格的坐标
坑点注意,不要用cin,cout,有时的偷懒会让你超时的!!!
(码的我也是好辛苦,特地来纪念一发~)
EBCDIC
Problem DescriptionA 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
题意:
给你两个表,输入的是对应第一张表的坐标,求对应符合在第二张表格的坐标
坑点注意,不要用cin,cout,有时的偷懒会让你超时的!!!
(码的我也是好辛苦,特地来纪念一发~)
#include <cstdio> #include <iostream> #include <cstdlib> #include <cstring> #include <string> #include <cmath> #include <vector> #include <algorithm> using namespace std; #define LL __int64 #define MOD 1000000007 const int INF = 0x3f3f3f3f; string A[16][16]= {"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 B[8][16]= {"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"}; //vector<int>q; int main() { char a,b; //string c; while(1) { a=getchar(); if(a=='\n')break; b=getchar(); int i,j,aa,bb; if(a>='A'&& a<='F')aa=a-'A'+10; if(a>='0'&& a<='9')aa=a-'0'; if(b>='A'&& b<='F')bb=b-'A'+10; if(b>='0'&& b<='9')bb=b-'0'; for(i=0; i<8; i++) { for(j=0; j<16; j++) if(B[i][j]==A[aa][bb]) { a=i+'0'; if(j>=0&&j<=9) b=j+'0'; else b=j-10+'A'; break; } } printf("%c%c",a,b); } printf("\n"); return 0; }
相关文章推荐
- 操作系统——第0篇
- OutMan——Foundation框架中的NSString类和NSMutableString类
- 桌面支持--不能显示中文字体,系统已调成中文 而且不能打字
- iOS开发学习之UIWindow
- 九度OJ 题目1069:查找学生信息
- 1073. Scientific Notation (20)
- UE4 Performance Guidelines for Mobile Devices
- HDU 5044——Tree
- hdu 1599
- SharePoint 2013 IT Professional—— 分布式安装部署
- IOS AutoLayout 好的建议搜集
- 【LeetCode】34_Search for a Range
- HDOJ 3068.最长回文(Manacher算法模板)
- sqlalchemy
- slf4j使用
- 桌面支持--ZWMECH软件卸载工具
- Mongoose入门
- java并发容器(Map、List、BlockingQueue)详解
- SDK 更新配置
- java 回调的使用