HDU-4690 EBCDIC 映射,模拟,沙茶

  题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4690

  纯沙茶模拟题。。。

 //STATUS:C++_AC_93MS_228KB
#include <functional>
#include <algorithm>
#include <iostream>
//#include <ext/rope>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;
//#pragma comment(linker,"/STACK:102400000,102400000")
//using namespace __gnu_cxx;
//define
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define PI acos(-1.0)
//typedef
typedef __int64 LL;
typedef unsigned __int64 ULL;
//const
const int N=;
const int INF=0x3f3f3f3f;
const int MOD=,STA=;
const LL LNF=1LL<<;
const double EPS=1e-;
const double OO=1e15;
const int dx[]={-,,,};
const int dy[]={,,,-};
const int day[]={,,,,,,,,,,,,};
//Daily Use ...
inline int sign(double x){return (x>EPS)-(x<-EPS);}
template<class T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> inline T lcm(T a,T b,T d){return a/d*b;}
template<class T> inline T Min(T a,T b){return a<b?a:b;}
template<class T> inline T Max(T a,T b){return a>b?a:b;}
template<class T> inline T Min(T a,T b,T c){return min(min(a, b),c);}
template<class T> inline T Max(T a,T b,T c){return max(max(a, b),c);}
template<class T> inline T Min(T a,T b,T c,T d){return min(min(a, b),min(c,d));}
template<class T> inline T Max(T a,T b,T c,T d){return max(max(a, b),max(c,d));}
//End int hs[N][N]={
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
{,,,,,,,,,,,,,,,},
}; char ma[]="0123456789ABCDEF"; inline int getnum(char c)
{
return c<=''?c-'':c-'A'+;
} int main(){
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
int i,j,x,y;
char c1,c2;
while((c1=getchar())!='\n')
{
c2=getchar();
x=getnum(c1);
y=getnum(c2);
printf("%c%c",ma[hs[x][y]/],ma[hs[x][y]%]);
}
putchar('\n');
return ;
} /*
NUL SOH STX ETX . HT . DEL . . . VT FF CR SO SI
DLE DC1 DC2 DC3 . . BS . CAN EM . . IFS IGS IRS IUSITB
. . . . . 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 . . . . . . 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 IUSITB
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 for(i=0;i<16;i++){
for(j=0;j<16;j++)
scanf("%s",E[i][j]);
}
for(i=0;i<8;i++){
for(j=0;j<16;j++)
scanf("%s",A[i][j]);
}
mem(hs,0);
for(i=0;i<16;i++){
for(j=0;j<16;j++){
if(!strcmp(E[i][j],".") && (i!=4 || j!=11))continue;
for(int p=0;p<8;p++){
for(int q=0;q<16;q++)
if(!strcmp(E[i][j],A[p][q])){
hs[i][j]=p*16+q;
}
}
}
}
for(i=0;i<16;i++){
printf("{%d",hs[i][0]);
for(j=1;j<16;j++){
printf(",%d",hs[i][j]);
}
printf("},\n");
}
*/
上一篇:Simple Event Correlation installation and configuration


下一篇:UVa 11825 (状压DP) Hackers' Crackdown