Composed Rhythms

면접 대비

시간 제한1초메모리 제한1024 MB

요약
주어진 박자 수 N을 2와 3의 합으로 나누고 각 묶음의 크기를 출력한다.
난이도

쉬움10점 중 2점

유형
수학, 그리디, 구현
정답자
아직 제출이 없습니다

문제

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 77 beats can be subdivided into 44 beats and 33 beats, or alternatively into 22, 33, and 22 beats. However, a rhythm of 77 beats cannot be subdivided into 11, 33, and 33 beats, since one of the components does not form a rhythm.

This leaves 22 as the smallest group size of beats we can use to decompose a rhythm, but if we only use groups of size 22 then we cannot have an odd number of beats. Adding 33 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 22 and 33.

입력

The first and only line of input contains a single integer NN (2≤N≤1062 \leq N \leq 10^6), denoting the number of beats in the rhythm.

출력

First output one line with an integer KK, the number of groups of which your decomposition consists. Then output a line with KK space-separated integers, each of which is a 22 or a 33. Your decomposition must be made up of the correct number of beats.

If there are multiple correct answers, you may output any of them.

예제1

  1. 예제 1

    입력
    25
    
    예상 출력
    9
    3 3 3 3 3 3 2 2 3