## Editorial for CCC '22 S1 - Good Fours and Good Fives

**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.**

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 non-negative integers and where and . This means we can try all possible values for and using two nested loops.

For a full solution, we can loop through only all possible values of to determine if there is a corresponding value of . For each of these values , this is equivalent to checking if is divisible by . Alternatively, we take a similar approach but 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 and considering the quotient and remainder when is divided by .

## Comments