Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int maximum(int a, int b, int c) {
  7.   return std::max(a, std::max(b, c));
  8. }
  9.  
  10. int main() {
  11.   ifstream cin("../problem.in");
  12.   ofstream cout("../problem.out");
  13.  
  14.   int testCase;
  15.   cin >> testCase;
  16.   system("pwd");
  17.   while (testCase-- > 0) {
  18.     int a, b, c, n;
  19.     cin >> a >> b >> c >> n;
  20.  
  21.     int total = a + b + c + n;
  22.     int average = total / 3;
  23.     cout << (total % 3 != 0 || maximum(a, b, c) > average ? "NO" : "YES") << endl;
  24.   }
  25.  
  26.   return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement