-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1742_Sum.cpp
More file actions
61 lines (57 loc) · 1.26 KB
/
Copy path1742_Sum.cpp
File metadata and controls
61 lines (57 loc) · 1.26 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* A. Sum
time limit per test 1 second
memory limit per test 256 megabytes
You are given three integers a, b, and c. Determine if one of them is the sum of the other two.
Input
The first line contains a single integer t (1≤t≤9261) — the number of test cases.
The description of each test case consists of three integers a, b, c (0≤a,b,c≤20).
Output
For each test case, output "YES" if one of the numbers is the sum of the other two, and "NO" otherwise.
You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
Example
Input:
7
1 4 3
2 5 8
9 11 20
0 0 0
20 20 20
4 12 3
15 7 8
Output:
YES
NO
YES
YES
NO
NO
YES
Note:
In the first test case, 1+3=4
In the second test case, none of the numbers is the sum of the other two.
In the third test case, 9+11=20
*/
#include<bits/stdc++.h>
using namespace std;
int t,n,i,j;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin>>t;
while(t--){
int a,b,c;
cin>>a>>b>>c;
if(a==b+c){
cout<<"YES\n";
}
else if(b==a+c){
cout<<"YES\n";
}
else if(c==a+b){
cout<<"YES\n";
}
else{
cout<<"NO\n";
}
}
}