其他分享
首页 > 其他分享> > CodeForces - 1388A Captain Flint and Crew Recruitment

CodeForces - 1388A 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 xx as nearly prime if it can be represented as p⋅qp⋅q, where 1<p<q1<p<q and pp and qq are prime numbers. For example, integers 66 and 1010 are nearly primes (since 2⋅3=62⋅3=6 and 2⋅5=102⋅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?

Input

The first line contains a single integer tt (1≤t≤10001≤t≤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≤n≤2⋅105) — the number Flint guessed.

Output

For each test case print:

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

Input
7
7
23
31
36
44
100
258
Output
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

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, n=31=2⋅7+2⋅5+2⋅3+1n=31=2⋅7+2⋅5+2⋅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⋅3+2⋅5+3⋅5: integers 66, 1010, 1515 are nearly prime.

In the fifth test case, n=44=2⋅3+7+2⋅5+3⋅7n=44=2⋅3+7+2⋅5+3⋅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⋅5+3⋅11+5⋅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⋅5+3⋅7+13⋅17+2⋅3: integers 1010, 2121, 221221, 66 are nearly prime.

题目大意:尽管弗林特船长名声不好,但他还是一个友好的人(至少对动物友好)。现在,弗林特上尉正在寻找值得的水手加入他的新船员(仅出于和平目的)。如果水手能够解决弗林特的任务,他就被认为是值得的。 最近,发疯的上尉弗林特(Flint)对数学感兴趣,甚至定义了一类新的整数。如果可以将正整数x表示为p⋅q,则将其定义为近似质数,其中1 <p <q,并且p和q是质数。例如,整数6和10几乎是质数(因为2⋅3=6和2⋅5=10),而整数1、3、4、16、17或44则不是。 弗林特船长猜到一个整数n并问您:您能否将其表示为4个不同的正整数之和,其中至少3个正整数应接近质数。 博格丹叔叔轻松解决了任务,并加入了机组人员。你能做得到吗?

 

代码如下:

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<algorithm>
 4 using namespace std;
 5 int main()
 6 {
 7     int t;
 8     scanf("%d",&t);
 9     for(int i=1;i<=t;i++)
10     {
11         int m;
12         scanf("%d",&m);
13         if(m>=31){
14             if(m!=36&&m!=40&&m!=44)
15             printf("YES\n6 10 14 %d\n",m-30);
16         else  printf("YES\n6 10 15 %d\n",m-31);
17         }
18         else{
19             printf("NO\n");
20         }
21     }
22 }

 

标签:prime,integers,CodeForces,Crew,Recruitment,Flint,nearly,test,YES
来源: https://www.cnblogs.com/linda-/p/13443264.html