Advertisement
Josif_tepe

Untitled

Mar 12th, 2024
766
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int a, b, c;
  7.     cin >> a >> b >> c;
  8.    
  9.     int niza[3];
  10.     niza[0] = a;
  11.     niza[1] = b;
  12.     niza[2] = c;
  13.     sort(niza, niza + 3);
  14.     a = niza[0];
  15.     b = niza[1];
  16.     c = niza[2];
  17.    
  18.     int max_a = a, max_b = b, max_c = c;
  19.     if(a >= 5) {
  20.         max_a = 5;
  21.     }
  22.     if(b >= 5) {
  23.         max_b = 5;
  24.     }
  25.     if(c >= 5) {
  26.         max_c = 5;
  27.     }
  28.     int sum = max_a + max_b + max_c;
  29.    
  30.     if(a + sum - max_a >= b - max_b or a + sum - max_a >= c - max_c or b + sum - max_b >= c - max_c) {
  31.         cout << "DA" << endl;
  32.     }
  33.     else {
  34.         cout << "NE" << endl;
  35.     }
  36.     return 0;
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement