Bachgold Problem
Time Limit: 1 Sec Memory Limit: 256 MB
Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.
Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer divisors — 1 and k.

传送门:CF749A

Input

The only line of the input contains a single integer n (2≤n≤100000).

Output

The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them.

Sample Input

1
5

Sample Output

1
2
2
2 3

题解

很简单,分解成最多的个数必然是2和3的组合 那就判断下如果原数是偶数就计算有几个2 原数是奇数就减去3然后计算有几个2,再加上一个3就好了
## AC code:(不包含输入类)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.io.*;  
import java.util.*;
public class Main {

public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int n=sc.nextInt();
int flag=0;
if(n%2!=0){
flag=1;
n=n-3;
}
int count=0;
count=n/2;
if(flag==1){ //原数是奇数
System.out.println(count+1);
}
else{
System.out.println(count);
}

if(flag==1){
System.out.print("3 ");
}
for(int i=1;i<=count;i++){
if(i==count){
System.out.print("2");
}
else{
System.out.print("2 ");
}
}
System.out.print('\n');
}

}
}