欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1388A.Captain Flint and Crew Recruitment
Captain Flint and Crew Recruitment
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 as nearly prime if it can be represented as , where and and are prime numbers. For example, integers and are nearly primes (since and ), but integers , , , , or are not.
Captain Flint guessed an integer and asked you: can you represent it as the sum of different positive integers where at least of them should be nearly prime.
Uncle Bogdan easily solved the task and joined the crew. Can you do the same?
Input
The first line contains a single integer () — the number of test cases.
Next lines contain test cases — one per line. The first and only line of each test case contains the single integer — the number Flint guessed.
Output
For each test case print:
YESand different positive integers such that at least of them are nearly prime and their sum is equal to (if there are multiple answers print any of them);NOif there is no way to represent as the sum of different positive integers where at least of them are nearly prime.
You can print each character of YES or NO in any case.
Note
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, : integers , , are nearly prime.
In the fourth test case, : integers , , are nearly prime.
In the fifth test case, : integers , , are nearly prime.
In the sixth test case, : integers , , are nearly prime.
In the seventh test case, $n=258=2 \cdot 5 + 3 \cdot 7 + 13 \cdot 17 + 2 \cdot 3$: integers , , , are nearly prime.
Samples
7
7
23
31
36
44
100
258
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
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |