Problem A: Decryption

Time Limit: 1 Sec  Memory Limit: 32 MB
Submit: 252  Solved: 93
[Submit][Status][Web Board]

Description

Little A often receives some encrypted files, of which are all encrypted into 4-length integer (base 10), now he want to decrypt these files.

The roles of decrypting this file are as follows:

1.       Translation all the 4-length integers into new numbers base 16.

2.       Change the figures into characters as 0 to A, 1 to B, 2 to C…

For example: 2014(base 10) -> 7de(base 16) -> Hde

Input

There are several test cases.

For each test case, first line contains a positive integer N (N<=100), followed by N 4-length integers.

If N=0, stop read in.

Output

For each test case, output the information after decrypting. The output of one test case occupied exactly one line.

Sample Input

31111 1987 659741485 1000 5987 444449999 9785 4737 19860

Sample Output

EFHHcDBJcFFcdDeIBHGDBBFcCHAfCGDJBCIBHcC

HINT




AC代码:

#include <stdio.h>
#include <string.h>


void deal(int x)
{
int t, tt, j, i = 0;
char ch[5] = {""};
t = x;
while (t>0)
{
tt = t%16;
switch (tt)
{
case 0:
ch[i] = 'A';
break;
case 1:
ch[i] = 'B';
break;
case 2:
ch[i] = 'C';
break;
case 3:
ch[i] = 'D';
break;
case 4:
ch[i] = 'E';
break;
case 5:
ch[i] = 'F';
break;
case 6:
ch[i] = 'G';
break;
case 7:
ch[i] = 'H';
break;
case 8:
ch[i] = 'I';
break;
case 9:
ch[i] = 'J';
break;
case 10:
ch[i] = 'a';
break;
case 11:
ch[i] = 'b';
break;
case 12:
ch[i] = 'c';
break;
case 13:
ch[i] = 'd';
break;
case 14:
ch[i] = 'e';
break;
case 15:
ch[i] = 'f';
break;
default:
;
}
++i;
t /= 16;
}
for (j=i-1;j>=0;--j)
printf("%c", ch[j]);
}


int main()
{
int n, i, tmp;
scanf("%d", &n);
while (n != 0)
{
for (i=0;i<n;++i)
{
scanf("%d", &tmp);
deal(tmp);
}
printf("\n");
scanf("%d", &n);
}
}