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.

Author: dxke02

Hint

The answer is never -1.

Subtask 1

The intended solution for this subtask is to output the sequence K, 2K, 3K, \dots, NK. Since all terms are divisible by K, their sum is also divisible by K.

Subtask 2

One possible answer is to first generate the sequence 1, 2, \dots, N-1, then fill in the last element with any element that makes the sum divisible by K.


Comments

There are no comments at the moment.