http://acm.hdu.edu.cn/showproblem.php?pid=4144
数字对应1,字母对应0,五位一算。
View Code
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int pow(int a,int b)
{
int i,s=1;
for(i=0;i<b;i++)
s*=a;
return s;
}
char a[11000];
char tab[30]={'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'};
int main()
{
int n,i;
int cnt,num;
while(~scanf("%d%*c",&n))
{
for(i=1;i<=n;i++)
scanf("%c",&a[i]);
cnt=4;
num=0;
for(i=1;i<=n;i++)
{
if(a[i]>='0'&&a[i]<='9')
num+=pow(2,cnt--);
else
cnt--;
if(i%5==0)
{
printf("%c",tab[num]);
num=0;
cnt=4;
}
}
putchar('\n');
}
return 0;
}