Verbatim https://www.dazhuanlan.com/2019/08/25/5d622bd96eb30/
Original title link
http://icpc.njust.edu.cn/Problem/Hdu/1265/
Description
Converts a real number s is represented by IEEE single precision floating point.
Input
First enter a number N (1 <= N <= 150), it indicates the number of instances; followed by N real numbers.
Output
Output IEEE floating point representation, capital letters.
Sample Input
1 |
2 |
Sample Output
1 |
41BECCCD |
Analysis
A clever way, the 4-byte floating-point 32-bit memory space to copy integer ANS,
Then in hexadecimal way to print an integer ans;
Variable ans use long or unsigned int, because there are 32, if int, 32-bit bit represents positive and negative, only 31 are available, it will not be enough.
Code
1 |
|