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.

Author: Rimuru

To check the digits after the decimal point, we can create another variable C as a cast of the original number. From there, we subtract X (the original number) by C, then check whether the difference is less than 0.5.

An alternative method is to check if N % 1 \ge 0.5, and output accordingly.


Comments

There are no comments at the moment.