Question link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 4144
The meaning is to divide the received string into five groups. In each group, if it is a character, it is regarded as 0. If it is a number, it is regarded as 1, in this way, the entire string is composed of 0 and 1. In each group, it is regarded as a binary number, and then converted to decimal. Finally, according to a is 0, B is 1 ...... And so on, convert it into characters.
Reference code:
# Include <stdio. h>
# Include <string. h>
Int N, I, j, t [10001], sum;
Char A [10001];
Int main ()
{
While (~ Scanf ("% d % * C", & n ))
{
Gets ();
For (I = 0; I <n; I ++)
{
If (A [I]> = '0' & A [I] <= '9 ')
T [I] = 1;
Else
T [I] = 0;
}
Sum = 0;
For (j = 0; j <n; j + = 5)
{
Sum = T [J] * 16 + T [J + 1] * 8 + T [J + 2] * 4 + T [J + 3] * 2 + T [J + 4];
Printf ("% C", 65 + sum );
}
Printf ("\ n ");
}
Return 0;
}