CF1388A.Captain Flint and Crew Recruitment

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Despite his bad reputation, Captain Flint is a friendly person (at least, friendly to animals). Now Captain Flint is searching worthy sailors to join his new crew (solely for peaceful purposes). A sailor is considered as worthy if he can solve Flint's task.

Recently, out of blue Captain Flint has been interested in math and even defined a new class of integers. Let's define a positive integer xx as nearly prime if it can be represented as p⋅qp \cdot q, where 1<p<q1 \lt p \lt q and pp and qq are prime numbers. For example, integers 66 and 1010 are nearly primes (since 2⋅3=62 \cdot 3 = 6 and 2⋅5=102 \cdot 5 = 10), but integers 11, 33, 44, 1616, 1717 or 4444 are not.

Captain Flint guessed an integer nn and asked you: can you represent it as the sum of 44 different positive integers where at least 33 of them should be nearly prime.

Uncle Bogdan easily solved the task and joined the crew. Can you do the same?

尽管声名狼藉,弗林特船长其实是个友善的人(至少对动物很友善)。目前,弗林特船长正在招募值得信赖的水手加入他的新船员队伍(纯粹出于和平目的)。一名水手若能解决弗林特船长布置的任务,便被视为“值得信赖”。

最近,弗林特船长突然对数学产生了兴趣,甚至定义了一类新的整数。我们称一个正整数 xx 为近似质数(nearly prime),如果它可以表示为 p⋅qp \cdot q 的形式,其中 1<p<q1 \lt p \lt q,且 pp 和 qq 均为质数。例如,整数 66 和 1010 是近似质数(因为 2⋅3=62 \cdot 3 = 6 且 2⋅5=102 \cdot 5 = 10),但整数 11、33、44、1616、1717 或 4444 则不是。

弗林特船长心里想好了一个整数 nn,并问你:能否将它表示为 4 个互不相同的正整数之和,且其中至少有 3 个是近似质数?

博格丹大叔轻松解出了这道题,并成功加入了船员队伍。你也能做到吗?

输入格式

The first line contains a single integer tt (1≤t≤10001 \le t \le 1000) — the number of test cases.

Next tt lines contain test cases — one per line. The first and only line of each test case contains the single integer nn (1≤n≤2⋅105)(1 \le n \le 2 \cdot 10^5) — the number Flint guessed.

第一行包含一个整数 tt(1≤t≤10001 \le t \le 1000)—— 测试用例的数量。

接下来的 tt 行为测试用例,每行一个测试用例。每个测试用例仅有一行,包含一个整数 nn(1≤n≤2⋅1051 \le n \le 2 \cdot 10^5)—— Flint 猜测的数字。

输出格式

For each test case print:

  • YES and 44 different positive integers such that at least 33 of them are nearly prime and their sum is equal to nn (if there are multiple answers print any of them);
  • NO if there is no way to represent nn as the sum of 44 different positive integers where at least 33 of them are nearly prime.

You can print each character of YES or NO in any case.

对每个测试用例,输出:

  • YES,以及 44 个互不相同的正整数,使得其中至少 33 个是近似质数(nearly prime),且它们的和等于 nn(若存在多种答案,输出任意一种即可);
  • 若无法将 nn 表示为 44 个互不相同的正整数之和,且其中至少 33 个是近似质数,则输出 NO。

YES 或 NO 中的每个字符可使用任意大小写形式。

输入输出样例

  • 输入#1

    7
    7
    23
    31
    36
    44
    100
    258

    输出#1

    NO
    NO
    YES
    14 10 6 1
    YES
    5 6 10 15
    YES
    6 7 10 21
    YES
    2 10 33 55
    YES
    10 21 221 6

说明/提示

In the first and second test cases, it can be proven that there are no four different positive integers such that at least three of them are nearly prime.

In the third test case, n=31=2⋅7+2⋅5+2⋅3+1n=31=2 \cdot 7 + 2 \cdot 5 + 2 \cdot 3 + 1: integers 1414, 1010, 66 are nearly prime.

In the fourth test case, n=36=5+2⋅3+2⋅5+3⋅5n=36=5 + 2 \cdot 3 + 2 \cdot 5 + 3 \cdot 5: integers 66, 1010, 1515 are nearly prime.

In the fifth test case, n=44=2⋅3+7+2⋅5+3⋅7n=44=2 \cdot 3 + 7 + 2 \cdot 5 + 3 \cdot 7: integers 66, 1010, 2121 are nearly prime.

In the sixth test case, n=100=2+2⋅5+3⋅11+5⋅11n=100=2 + 2 \cdot 5 + 3 \cdot 11 + 5 \cdot 11: integers 1010, 3333, 5555 are nearly prime.

In the seventh test case, n=258=2⋅5+3⋅7+13⋅17+2⋅3n=258=2 \cdot 5 + 3 \cdot 7 + 13 \cdot 17 + 2 \cdot 3: integers 1010, 2121, 221221, 66 are nearly prime.

在第一和第二个测试用例中,可以证明不存在四个互不相同的正整数,使得其中至少有三个是近似质数(nearly prime)。

在第三个测试用例中,n=31=2⋅7+2⋅5+2⋅3+1n=31=2 \cdot 7 + 2 \cdot 5 + 2 \cdot 3 + 1:整数 1414、1010、66 是近似质数。

在第四个测试用例中,n=36=5+2⋅3+2⋅5+3⋅5n=36=5 + 2 \cdot 3 + 2 \cdot 5 + 3 \cdot 5:整数 66、1010、1515 是近似质数。

在第五个测试用例中,n=44=2⋅3+7+2⋅5+3⋅7n=44=2 \cdot 3 + 7 + 2 \cdot 5 + 3 \cdot 7:整数 66、1010、2121 是近似质数。

在第六个测试用例中,n=100=2+2⋅5+3⋅11+5⋅11n=100=2 + 2 \cdot 5 + 3 \cdot 11 + 5 \cdot 11:整数 1010、3333、5555 是近似质数。

在第七个测试用例中,n=258=2⋅5+3⋅7+13⋅17+2⋅3n=258=2 \cdot 5 + 3 \cdot 7 + 13 \cdot 17 + 2 \cdot 3:整数 1010、2121、221221、66 是近似质数。

输入解题思路,AI测评打分。不知道怎么写?

首页