#K38687. Rhythmic Sequence Generation
Rhythmic Sequence Generation
Rhythmic Sequence Generation
In this problem, you are given two integers ( n ) and ( k ). Your task is to generate a rhythmic sequence of length ( n ), where each element at index ( i ) (with ( i ) starting from 0) is defined by the formula:
[
\text{element}_{i} = (i \mod k) + 1
]
For example, if ( n = 10 ) and ( k = 3 ), the sequence generated is:
1 2 3 1 2 3 1 2 3 1.
This problem tests your ability to work with simple arithmetic operations and sequence generation.
inputFormat
The input consists of a single line containing two integers ( n ) and ( k ) separated by a space.
outputFormat
Output the rhythmic sequence of ( n ) integers in a single line, with each integer separated by a space. The sequence should be generated according to the formula:
[
\text{element}_{i} = (i \mod k) + 1
]## sample
10 3
1 2 3 1 2 3 1 2 3 1