Editorial for CCC '22 S1 - Good Fours and Good Fives
Submitting an official solution before solving the problem yourself is a bannable offence.
The first problem is designed to be accessible with some insight required to obtain full marks.
The first subtask can be hard-coded. That is, the following table can be calculated by hand and a solution can mimic looking up the correct output in the table.
Output |
---|
For the second and third subtasks, we can notice that we need
For a full solution, we can loop through only all possible values of
There is also a clever extremely quick solution that involves extending the table listed above for the first
subtask to
Comments