IIITD1 - Those College Days!
Once there was a Shikaari in IIIT Delhi campus and he was famous for his Shikaar techniques. Also there was Kalakhatta who was jealous of Shikaari’s charisma. Once Kalakhatta challenged Shikaari to test his knowledge. Now Shikaari’s afraid of losing, would you help?
You are given a number N and you have to increment the Most Significant digit without changing any other number in N. You can do this by adding a positive number X.
The first line of the input consist of a single integer number T which determines the number of tests.
In each of next t lines there is a single integer number N.
- 0 < t ≤ 105
- | n | ≤ 109
Print the minimum number X in separate lines.
C++14 (gcc 6.3) => Wrong ans,
Thanks to @prasad_235Last edit: 2018-01-07 21:03:40
Any tricky test cases?
AC in 1 go :)
@stcsteven it's not mainly about the negetive sign as MSD.
Last edit: 2017-06-14 13:07:58
Why is x = 3 for n = -1?
If n is -1 and the answer is 3, then does it mean if the number is negative, you would consider the negative mark as the MSD?