hdu4690 EBCDIC ——水题,考耐心

link:http://acm.hdu.edu.cn/showproblem.php?pid=4690

考的是耐心何细心啊,用map把两个表格映射一下就行~

 #include <iostream>
 #include <cstdio>
 #include <cstdlib>
 #include <cstring>
 #include <cmath>
 #include <cctype>
 #include <algorithm>
 #include <queue>
 #include <deque>
 #include <queue>
 #include <list>
 #include <map>
 #include <set>
 #include <vector>
 #include <utility>
 #include <functional>
 #include <fstream>
 #include <iomanip>
 #include <sstream>
 #include <numeric>
 #include <cassert>
 #include <ctime>
 #include <iterator>
 const int INF = 0x3f3f3f3f;
 ][] = {{-,},{,},{,-},{,},{-,-},{-,},{,-},{,}};
 using namespace std;
 ][] = {
     "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","","","","","","",
     ","","","","","",""
 };
 ][] = {
 "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"
 };
 map<pair<int,int>, pair<int,int> > coll;
 int main(void)
 {
     #ifndef ONLINE_JUDGE
     freopen("in.txt", "r", stdin );
     #endif // ONLINE_JUDGE
     string sad;
     ios::sync_with_stdio(false);
     cin>>sad; coll.clear();
     string tmp; pair<int,int> so, to;
     ; i < ; ++i)
     {
         ; j < ; ++j)
         {
             if (A[i][j]!="")
             {
                 so.first=i, so.second=j;
                 bool mrk = false;
                 ; k < ; ++k)
                 {
                     ; h < ; ++h)
                     {
                         if (A[i][j]==B[k][h])
                         {
                             mrk = true;
                             to.first=k,to.second=h;
                             coll[so] = to; break;
                         }
                     }
                     if (mrk) break;
                 }
             }
         }
     }
     ; i < sad.size(); i+=)
     {
         int X, Y; tmp.clear();
         ;
         ';
         ]>=]<=]- ;
         ] - ';
         pair<int,int> hehe, TM;
         hehe.first = X, hehe.second = Y;
         TM = coll[hehe];
         int j = TM.first, k = TM.second;
         char XX, YY;
         XX = j+ ';
         ) YY = k -  + 'A';
         ';
         printf("%c%c", XX, YY);
     }
     printf("\n");

     ;
 }

写那两个数组没有vim的帮助手是不是得残了……

还有一个就是,当你发现程序某一小段怎么都不对的时候,也许重新写一下就OK了,调试了很久……

走吧,小胖!

上一篇:Spring---加载配置文件的几种方法(org.springframework.beans.factory.BeanDefinitionStoreException)


下一篇:java根据xml配置文件导出excel通用方法