Problem Author: | Mohammad Nasser (MOAGEZA) |
Prepared by: | Mohammad Nasser (MOAGEZA) |
Edited by: | Hasan Saleh (MathModel) |
Solution
General Idea: There are exactly red cards in total. If the three players report , , and red cards, then the fourth player must have:
red cards.
The game must restart if **any** player has at least red cards. Therefore, we simply compute the maximum among the four players:
If this value is , restarting is guaranteed; otherwise, it is not required.
The solution runs in time per test case.
#include <bits/stdc++.h>
using namespace std;
void solve(){
int a,b,c;
cin>>a>>b>>c;
int mx = max({a,b,c,7-(a+b+c)});
if(mx>=5) cout<<"YES";
else cout<<"NO";
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin>>t;
while(t--){
solve();
cout<<'\n';
}
}