Hudson River TradingOA #1
Integer to String Without Built-ins
Estimated EasyJudge-ready
Topics (AI-labelled)StringsBits & Math
Implement conversion from an integer to a decimal string without using built-in number-to-string functions. Output one line for each signed 32-bit integer in the input; negative numbers keep the minus sign, and 0 is output as 0.
The upstream original problem forbids a built-in conversion helper; this site's judge can only verify the output and cannot statically prove that a contestant did not call a built-in conversion function.
Input
Each line contains one signed 32-bit integer; there are 1..100000 lines. The last line of input may or may not end with a newline.
Output
Output one line with the decimal representation of each input integer.
Example 1
Input:
0
42
-17
2147483647
-2147483648
Output:
0
42
-17
2147483647
-2147483648
Example 2
Input:
0
Output:
0
Example 3
Input:
-1000000000
1000000000
Output:
-1000000000
1000000000
Editorial
Loading solution…