CF749A.Bachgold Problem
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
巴赫戈尔德问题(Bachgold problem)的表述非常简单:给定一个正整数 n,将其表示为尽可能多的素数之和。可以证明,对于任意大于 1 的整数,这样的表示总是存在的。
回顾一下,若整数 k 大于 1,且恰好有两个正整数因子(即 1 和 k),则称 k 为素数。
输入格式
The only line of the input contains a single integer n (2 ≤ n ≤ 100 000).
输入仅包含一行,其中有一个整数 n(2 ≤ n ≤ 100000)。
输出格式
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.
输出的第一行包含一个整数 k —— 表示表示中素数个数的最大可能值。
第二行应包含 k 个素数,它们的和等于 n。你可以以任意顺序输出这些素数。如果存在多个最优解,输出其中任意一个即可。
输入输出样例
输入#1
5
输出#1
2 2 3
输入#2
6
输出#2
3 2 2 2
输入解题思路,AI测评打分。不知道怎么写?