Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.io.PrintWriter;
- import java.util.StringTokenizer;
- public class Primes {
- private void solve() throws IOException {
- int n = readInt();
- out.println(n / 2);
- while (n > 3) {
- out.print(2 + " ");
- n -= 2;
- }
- out.println(n);
- }
- //------------------------------------------------------------------------------
- public static void main(String[] args) {
- new Primes().run();
- }
- private void run() {
- try {
- initIO();
- solve();
- in.close();
- out.close();
- } catch (Throwable e) {
- throw new RuntimeException(e);
- }
- }
- private BufferedReader in;
- private StringTokenizer tok;
- private PrintWriter out;
- private void initIO() throws IOException {
- in = new BufferedReader(new InputStreamReader(System.in));
- out = new PrintWriter(System.out);
- // in = new BufferedReader(new FileReader(new File("input.txt")));
- // out = new PrintWriter(new File("output.txt"));
- }
- private String readString() throws IOException {
- while (tok == null || !tok.hasMoreTokens()) {
- tok = new StringTokenizer(in.readLine());
- }
- return tok.nextToken();
- }
- @SuppressWarnings("unused")
- private int readInt() throws IOException {
- return Integer.parseInt(readString());
- }
- @SuppressWarnings("unused")
- private long readLong() throws IOException {
- return Integer.parseInt(readString());
- }
- @SuppressWarnings("unused")
- private double readDouble() throws IOException {
- return Double.parseDouble(readString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement