Iamtui1010

tribeau

Nov 10th, 2021
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. //#include<bits/stdc++.h>
  2. #include<iostream>
  3. #include<vector>
  4.  
  5. #define long long long
  6. #define nln '\n'
  7.  
  8. using namespace std;
  9.  
  10. // Global variables: a, d
  11.  
  12. vector<long> a;
  13. long d;
  14.  
  15. void data()
  16. {
  17.     a.resize(3, 0);
  18.     for (long i = 0; i != 3; ++i)
  19.         cin >> a[i];
  20.     cin >> d;
  21. }
  22.  
  23. void process()
  24. {
  25.     long max = -1;
  26.     for (long i = 0; i != 2; ++i)
  27.         for (long j = i+1; j != 3; ++j)
  28.         {
  29.             long tem = abs(a[i]-a[j]);
  30.             if (tem > max)
  31.                 max = tem;
  32.         }
  33.     if (max > d)
  34.         cout << "No";
  35.     else
  36.         cout << "Yes";
  37. }
  38.  
  39. int main()
  40. {
  41.     data();
  42.     process();
  43.     return 0;
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment