PROBLEM 62
Medium

Triangle Existence

Programming Basics · Python

</>
STATUS Not solved

TASK

Problem

#62

Given positive sides `a`, `b`, `c`, print `YES` if a triangle can exist, else `NO`.

EXAMPLE

Example

Input
3 4 5
Output
YES

LIMITS

Constraints

a > 0; b > 0; c > 0
📖
LEARN Theory for this problem
+

`input()` reads data entered by the user. The result of `input()` is initially a string. `split()` separates one input line into individual values using spaces. `map()` applies the specified conversion to each input value. The `+` operator adds numbers. Comparison operators `==`, `!=`, `<`, `>`, `<=`, `>=` compare values and produce `True` or `False`. `and` requires all combined conditions to be true. `if` checks a condition and runs its block when the condition is true. `else` runs when the corresponding `if` condition is false. `print()` displays the program result. Print only what the problem statement requires.

**Connection to this task.** An `if` statement chooses a program branch from a Boolean condition. Comparisons produce `True` or `False`, and `elif` lets you test several mutually exclusive cases in order. The expression `'YES'` shows how this idea is applied to the task data.

💡
NEED HELP? Hints
+

['Each side must be less than the sum of the other two.']

ANSWER Solution
+
a, b, c = map(int, input().split())
if a + b > c and a + c > b and (b + c > a):
    print('YES')
else:
    print('NO')