-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA_Sum_of_Three.java
38 lines (38 loc) · 1.04 KB
/
A_Sum_of_Three.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.util.*;
public class A_Sum_of_Three
{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
int t=in.nextInt();
while(t>0){
int n=in.nextInt();
if(n<=6)
{
System.out.println("NO");
}
else
{
int a=1,b=2;
for(int i=4;i<n;i++)
{
if(i%3!=0){
int sum=a+b;
if((n-sum)%3==0)
b=i;
else if((n-sum)<=b)
{
System.out.println("NO");
break;
}
else
{
System.out.println("YES\n"+a+" "+b+" "+(n-sum));
break;
}
}
}
}
t--;
}
}
}