Editorial for GlobeX Cup '18 J1 - Rounding Errors
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
To check the digits after the decimal point, we can create another variable as a cast of the original number. From there, we subtract
(the original number) by
, then check whether the difference is less than
.
An alternative method is to check if N % 1
, and output accordingly.
Comments