Guest User

Untitled

a guest
Feb 7th, 2017
3,105
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n;
  7.     cin >> n;
  8.     int arr[n];
  9.     for (int i=0;i<n;i++)
  10.     cin >> arr[i];
  11.     sort(arr,arr+n);
  12.     for (int i=1;i<n-1;i++)
  13.     {
  14.         if (arr[i-1]+arr[i]>arr[i+1])
  15.         {
  16.             cout << "YES";
  17.             return 0;
  18.         }
  19.     }
  20.     cout << "NO";
  21. }
RAW Paste Data