fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. bool triangle(int a, int b, int c){
  5. bool res = (a+b>c)&&(b+c>a)&&(c+a>b);
  6. return res;
  7. }
  8.  
  9. int main() {
  10. int a,b,c,d;
  11. cin >> a >> b >> c >> d;
  12. if(
  13. triangle(a,b,c)||
  14. triangle(d,b,c)||
  15. triangle(a,d,c)||
  16. triangle(a,b,d)
  17. ){
  18. cout << "YES";
  19. }
  20. else{
  21. cout << "NO";
  22. }
  23. }
Success #stdin #stdout 0.01s 5284KB
stdin
1
2
3
8
stdout
NO