-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCatsAndDogs.java
More file actions
40 lines (30 loc) · 940 Bytes
/
CatsAndDogs.java
File metadata and controls
40 lines (30 loc) · 940 Bytes
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
39
40
package problems.codechef;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* Created by arpit on 7/1/17.
*/
public class CatsAndDogs {
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t,c,d,l;
String []s;
t=Integer.parseInt(br.readLine());
while (t-->0){
s=br.readLine().split("\\s");
c=Integer.parseInt(s[0]);
d=Integer.parseInt(s[1]);
l=Integer.parseInt(s[2]);
System.out.println(solve(c,d,l));
}
}
private static String solve(int c, int d, int l) {
long minLegs=d;
long totalLegs=(long)(c+d)*4;
if (c>2*d)
minLegs+=c-2*d;
minLegs*=4;
if (l>=minLegs && l<=totalLegs && l%4==0)return "yes";
return "no";
}}