시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1.5 초 | 512 MB | 44 | 24 | 23 | 53.488% |
After all these months of lockdown, you are tired of the interior decoration of your home and decide to redesign it. Hence, you read many blog posts and magazines about Feng Shui decorating and other recent trends on home design. After some time of thinking, you decide to reproduce the idea of the famous designer Sweta Marc for replacing your bookcase with a new one you will build.
According to S. Marc, a harmonious bookcase always has several shelves spaced in an heterogeneous manner, and always following some very precise rules. More precisely, such a bookcase has a serenity value $N$ and is composed of $K+1$ shelves spaced by $s_1, \ldots, s_K$ millimeters between each other, from the bottom to the top. According to S. Marc ideals, these spaces should verify the following properties:
You tried to design a bookcase according to the advice of Sweta Marc, but you find it hard to satisfy all the requirements. The only few solutions you found result in a bookcase which is too tall for your place.
Therefore, you decide to write a program which, given the number of shelves $K$ and the serenity value $N$, computes the values of the spaces $s_1, \ldots, s_K$ of one of the minimum height bookcases, i.e. a bookcase where the sum of spaces $s_1 + \cdots + s_K$ is the smallest.
The only line of input contains two integers $N$ and $K$ separated by a space.
The output should contain a single line containing either:
18 10
11 13 15 1 2 4 7 9 12 0
168 9
1 2 4 7 9 12 18 24 32
We recall the following mathematical definitions ($a$ and $b$ are arbitrary integers):
ICPC > Regionals > Europe > Southwestern European Regional Contest > SWERC 2020-2021 G번