public static void main(String args[] ) throws Exception {
Scan s1 = new Scan();
StringBuilder sb = new StringBuilder();
int t = s1.scanInt();
while(t--!=0)
{
long one=s1.scanInt();
long two = s1.scanInt();
long three = s1.scanInt();
long sum = (long)one+(long)(2*two)+(long)(three*3);
// System.out.println(sum);
if(sum%2!=0)
{
System.out.println("NO");
}
else
{
long temp = sum/2;
long ar[] = new long[3];
ar[0]=one;
ar[1]=two;
ar[2]=three;
long ma = temp/2;
ma = Math.min(ma, ar[1]);
long demo = ma*2;
temp=temp-demo;
if(temp==0)
{
System.out.println("YES");
}
else
{
ma = temp/3;
ma = Math.min(ma, ar[2]);
temp=temp-(ma*3);
// System.out.println(temp+" "+ar[2]);
if(temp==0 || temp<=ar[0])
{
System.out.println("YES");
}
else
{
System.out.println("NO");
}
}
}
}
Looks like it fails on 0 2 2
3 Likes
thanks got the problem.