CF749A Bachgold Problem

    • 36通过
    • 46提交
  • 题目来源 CodeForces 749A
  • 评测方式 RemoteJudge
  • 标签
  • 难度 普及-
  • 时空限制 1000ms / 256MB

题解

  • 提示:收藏到任务计划后,可在首页查看。
  • 体验新版界面

    最新讨论 显示

    推荐的相关题目 显示

    题意翻译

    给你一个整数$n$ ($2\leq n\leq 100000$ ),问最多能将其分解成多少质数的和。在第一行输出最多的质数数量$k$ ,下一行输出$k$ 个整数,为这些质数。

    一个大于$1$ 的数如果只能被$1$ 和它自己整除,那它就是一个质数。

    By @Khassar

    题目描述

    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 $ .

    输入输出格式

    输入格式:

    The only line of the input contains a single integer $ 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.

    输入输出样例

    输入样例#1: 复制
    5
    
    输出样例#1: 复制
    2
    2 3
    
    输入样例#2: 复制
    6
    
    输出样例#2: 复制
    3
    2 2 2
    
    提示
    标程仅供做题后或实在无思路时参考。
    请自觉、自律地使用该功能并请对自己的学习负责。
    如果发现恶意抄袭标程,将按照I类违反进行处理。