Editorial for LCC/Moose '19 Contest 1 J1 - Jaden Smith


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: Riolku

First, we will solve this problem when  N is a positive integer.

In this case, simply print  N - 1 , since the condition is strictly less than.

Next, solve the problem if  N \le 0 .

Now, if  N is not positive, there are 0 positive integers less than  N . In this case, use a simple conditional or a max function to output  \text{max}(0, N - 1) .

Finally, if  N is not an integer, then the integer part of  N is included in the list, so we should output the integer part of  N . However, if  N is an integer, we should still output  N - 1 . One way to solve this is to use a ceil function, so that you get the first number greater than or equal to  N which is an integer.

Therefore, in total, you should output  \text{max}(\lceil N \rceil - 1, 0) .


Comments

There are no comments at the moment.