TESTCON0 - Test Binary to Hexadecimal Converting
The binary system uses {0, 1} to represent values and it can represent only two different values in one binary digit (bit).
But hexadecimal uses {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F} so it can represent 16 different value in on digit.
To convert a binary number to hexadecimal we can convert every nibble (collection of 4 consecutive bits) alone.
0010 to 2 and 0100 to 4, 1100 to C, 1111 to F and so on.
You are giving a 32-bit binary number and you have to print it in hexadecimal.
Input
32-bit binary number.
Output
The hexadecimal represention of the input number (use capital letters for { A, B, C, D, E, F })
Example
Input: 11111111111111111111111111111111 Output: FFFFFFFF
Added by: | Mostafa 36a2 |
Date: | 2013-12-30 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Thank you SPOJ |