#C1044. Cyclic Pattern Generation
Cyclic Pattern Generation
Cyclic Pattern Generation
You are given an integer n
. Your task is to generate a cyclic pattern of digits where the digits from 0 to 9 repeat over and over until the resulting pattern has exactly n
characters.
For example, if n = 12
, the output should be 012345678901
because after reaching 9 the cycle starts again from 0. If n
is zero or negative, output an empty string.
The cyclic pattern is defined by the formula:
\(pattern[i] = i \mod 10\)
where \(i\) ranges from 0 to \(n-1\).
inputFormat
The input is provided via standard input and consists of a single integer n
which indicates the length of the pattern you need to generate.
outputFormat
Print the cyclic pattern of digits as described. If n
is zero or negative, print an empty string.
12
012345678901