Bob and Alice are having a lockout match between them. There are three problems in the contest worth , , and points respectively. Only the first player to solve a problem gets points for that problem. It is impossible for Bob and Alice to solve a problem at the same time. Chef wants to know if there is any chance of a draw if Bob and Alice manage to solve all problems. A draw occurs when both players end with equal number of points.
Input Format
- First line will contain , number of testcases. Then the testcases follow.
- Each testcase contains of a single line of input, three space separated integers , , and .
Output Format
For each testcase, output YES if the match can end in a draw, and NO otherwise.
You may print each character of the string in uppercase or lowercase (for example, the strings "yEs", "yes", "Yes" and "YES" will all be treated as identical).
Constraints
Subtasks
Subtask #1 (100 points): original constraints
Sample Input 1
3
2 5 2
4 2 2
3 5 5
Sample Output 1
NO
YES
NO
Explanation
In the first and third test cases, it is impossible for Bob and Alice to solve the problems so that they have the same number of points at the end.
In the second case, it is possible for Bob to solve the first problem, and Alice to solve the last two problems, in which case they will both have 4 points and the game will end in a draw
Solution:
#include <iostream>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int a,b,c;
cin>>a>>b>>c;
bool flag=false;
if(a+b==c || a+c==b||b+c==a){
flag=true;
}
if(flag){
cout<<"YES"<<endl;
}else{
cout<<"NO"<<endl;
}
}
return 0;
}
No comments:
Post a Comment