-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquares1351.java
More file actions
44 lines (41 loc) · 1.03 KB
/
Squares1351.java
File metadata and controls
44 lines (41 loc) · 1.03 KB
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
41
42
43
44
/**
* URL : https://codeforces.com/problemset/problem/1351/B
* @author wasitshafi
* @since 09-05-2020
*/
import java.util.Scanner;
public class Squares1351
{
public static void main(String args[])
{
int tc, x, y, p, q;
Scanner scan = new Scanner(System.in);
StringBuilder output = new StringBuilder("");
tc = scan.nextInt();
while(tc-- != 0)
{
x = scan.nextInt();
y = scan.nextInt();
p = scan.nextInt();
q = scan.nextInt();
if(x < y)
{
x = x + y;
y = x - y;
x = x - y;
}
if(p < q)
{
p = p + q;
q = p - q;
p = p - q;
}
if(x == p && x == y + q)
output.append("YES\n");
else
output.append("NO\n");
}
System.out.println(output);
scan.close();
}
}