Editorial for An Animal Contest 6 P1 - Workout Routine
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:
Hint
The answer is never .
Subtask 1
The intended solution for this subtask is to output the sequence . Since all terms are divisible by , their sum is also divisible by .
Subtask 2
One possible answer is to first generate the sequence , then fill in the last element with any element that makes the sum divisible by .
Comments
As as alternative I used, could be doubled until it is strictly greater than (as multiples of are divisible by ). Then for each integer in , and could be used. In addition if is odd then itself could be added.