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.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
First, we will solve this problem when is a positive integer.
In this case, simply print , since the condition is strictly less than.
Next, solve the problem if .
Now, if is not positive, there are 0 positive integers less than . In this case, use a simple conditional or a max
function to output .
Finally, if is not an integer, then the integer part of is included in the list, so we should output the integer part of . However, if is an integer, we should still output . One way to solve this is to use a ceil
function, so that you get the first number greater than or equal to which is an integer.
Therefore, in total, you should output .
Comments