Editorial for LCC '21 Contest 1 S1 - Password Please
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:
Because there are only possible numbers for each digit (
to
since Alan does not like
), and the password has to be
digits, a nested loop of
for loops from
to
is able to pass. You can also guarantee the lexicographically smallest solution by breaking out of the loops once you get a correct answer.
Comments