D. Dima and Lisa
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Dima loves representing an odd number as the sum of multiple primes, and Lisa loves it when there are at most three primes. Help them to represent the given number as the sum of at most than three primes.

More formally, you are given an odd numer n. Find a set of numbers pi (1 ≤ i ≤ k), such that

  1. 1 ≤ k ≤ 3
  2. pi is a prime

The numbers pi do not necessarily have to be distinct. It is guaranteed that at least one possible solution exists.

Input

The single line contains an odd number n (3 ≤ n < 109).

Output

In the first line print k (1 ≤ k ≤ 3), showing how many numbers are in the representation you found.

In the second line print numbers pi in any order. If there are multiple possible solutions, you can print any of them.

Examples
Input
27
Output
3
5 11 11
Note

A prime is an integer strictly larger than one that is divisible only by one and by itself.

题意:

  1. 1 ≤ k ≤ 3
  2. pi is a prime
  3.        输出这n个数

题解:

n为奇数    所有的素数 除了2  都是奇数   奇数+奇数=偶数   奇数+偶数=奇数

1.若n为素数  则输出n

2.若n-2为素数  则输出 2 n-2

3. 其余的暴力 定第一个数为3  找到满足条件的  i  n-i-3

 #include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<stack>
#include<cmath>
#define ll __int64
#define pi acos(-1.0)
#define mod 1000000007
using namespace std;
int n;
bool fun(int exm)
{
if(exm<=)
return false;
for(int i=;i*i<=exm;i++)
{
if(exm%i==)
return false;
}
return true;
}
int main()
{
scanf("%d",&n);
if(fun(n))
{
cout<<""<<endl<<n<<endl;
return ;
}
if(fun(n-))
{
cout<<""<<endl<<"2 "<<n-<<endl;
return ;
}
for(int i=;i<=n-;i++)
{
if(fun(i)&&fun(n--i))
{
cout<<""<<endl<<"3 "<<i<<" "<<n--i<<endl;
return ;
}
}
return ;
}

最新文章

  1. 1.ASP.NET MVC使用EPPlus,导出数据到Excel中
  2. 同一台电脑上多个myeclipse破解的问题
  3. pair correlation ggpair ggmatrix
  4. java打包成jar,但不打包配置文件
  5. 使用dynamic获取类型可变的json对象
  6. HBase分布式安装
  7. HTML第一天学习笔记
  8. HTML 菜单 a 标签设置样式
  9. linux点滴:NFS
  10. C#微信公众号开发 -- (三)用户关注之后自动回复
  11. keydown和keypress
  12. bzoj4828 [Hnoi2017]大佬
  13. HTK语音识别示例(Ubuntu)
  14. PHP微信公众号JSAPI网页支付(下)
  15. Lucene用法示例
  16. C# QuartZ使用实例写成服务
  17. SparkException: Master removed our application
  18. 手记:配置IIS服务器,支持sis、SISX、3GP、ADP、AMR、JAD、JAR、MMF、MFM、PMD、UMD等文件下载
  19. ftp 命令行操作 经常使用命令
  20. Bootstrap3实现的响应式幻灯滑动效果个人作品集/博客网站模板

热门文章

  1. 前端性能优化JavaScript篇
  2. swoole中swoole_timer_tick回调函数使用对象方法
  3. 解决scp命令pemission denied,please try again的问题
  4. C# 控件置于最顶层、最底层、隐藏、显示
  5. 用for循环计算(1-3+5-7...99)的结果(两种方法)
  6. python几个复习例子
  7. 如何使用malloc申请一个二位数组
  8. 剑指Offer - 九度1506 - 求1+2+3+...+n
  9. js点击重置按钮重置表单
  10. 嵌入式(Embedded System)笔记 —— Cortex-M3 Introduction and Basics(下)