编程介的小学生 2017-02-17 16:14 采纳率: 20.5%
浏览 958
已采纳

Index of Prime

Let P1, P2, P3....be a sequence of prime numbers. Index of prime for number is 0 iff it is impossible to present it as a sum of few (maybe one) prime numbers, and if such presentation exists, index is equal to minimal number of items in such presentation. Your task is to find index of prime for given numbers and find optimal presentation as a sum of primes.

Input

There are several test cases. Each test case contains a number which is not more than 10000 in a line.

Output

For each test case, first output the index I for the corresponding given number in a line and then write I prime numbers that are items in optimal presentation for the given number. Write these I numbers in order of non-increasing. If there is a tie, output the one in order of smallest dictionary order.

Sample Input

6

Sample Output

2
3 3

  • 写回答

2条回答 默认 最新

  • threenewbee 2017-02-22 14:18
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置