| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 133 | 102 | 85 | 75.221% |
Rhythm is an important part of music and it is crucial for aspiring musicians to gain understanding of it. As the skill of the musician advances, more complex rhythms are introduced to them. To ease the learning of musical passages, a method of simplifying rhythms can be helpful. One method is to reduce the rhythm into groups of twos and threes.
A rhythm is composed of multiple beats. A single beat does not make up a rhythm, as the beats depend on each other. The rhythm can be subdivided into smaller components. For example, a rhythm of 7ドル$ beats can be subdivided into 4ドル$ beats and 3ドル$ beats, or alternatively into 2ドル,ドル 3ドル,ドル and 2ドル$ beats. However, a rhythm of 7ドル$ beats cannot be subdivided into 1ドル,ドル 3ドル,ドル and 3ドル$ beats, since one of the components does not form a rhythm.
This leaves 2ドル$ as the smallest group size of beats we can use to decompose a rhythm, but if we only use groups of size 2ドル$ then we cannot have an odd number of beats. Adding 3ドル$ as a group size allows us to decompose any rhythm, even if it has an odd number of beats.
Given the number of beats in a rhythm, provide one decomposition of the rhythm into groups of sizes 2ドル$ and 3ドル$.
The first and only line of input contains a single integer $N$ (2ドル \leq N \leq 10^6$), denoting the number of beats in the rhythm.
First output one line with an integer $K,ドル the number of groups of which your decomposition consists. Then output a line with $K$ space-separated integers, each of which is a 2ドル$ or a 3ドル$. Your decomposition must be made up of the correct number of beats.
If there are multiple correct answers, you may output any of them.
25
9 3 3 3 3 3 3 2 2 3
ICPC > Regionals > Europe > Northwestern European Regional Contest > Nordic Collegiate Programming Contest > NCPC 2024 C번