Ankit_132

B

Oct 12th, 2023
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1.  
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. #define _test int _TEST; cin>>_TEST; while(_TEST--)
  7.  
  8. int main()
  9. {
  10. _test
  11. {
  12. int a, b, c;
  13. cin>>a>>b>>c;
  14.  
  15. multiset<int> mst;
  16.  
  17. mst.insert(a);
  18. mst.insert(b);
  19. mst.insert(c);
  20.  
  21. for(int i=0; i<3 && *mst.rbegin()!=*mst.begin(); i++)
  22. {
  23. int x = *mst.rbegin();
  24. mst.erase(--mst.end());
  25.  
  26. mst.insert(*mst.begin());
  27. mst.insert(x-*mst.begin());
  28. }
  29.  
  30. if(*mst.rbegin()==*mst.begin()) cout<<"YES\n";
  31. else cout<<"NO\n";
  32. }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment