#C8572. Triangular Triplets
Triangular Triplets
Triangular Triplets
Given a list of integers, determine whether there exists a triangular triplet among them. A triangular triplet consists of three numbers \(a\), \(b\), and \(c\) that satisfy:
- \(a + b > c\)
- \(a + c > b\)
- \(b + c > a\)
You are required to read the input from stdin and output the result to stdout as either True
or False
.
Note: The list can be in any order and may contain duplicate elements.
inputFormat
The first line of input contains a single integer n
which denotes the number of integers in the list. The second line contains n
space-separated integers.
outputFormat
Output a single line with either True
if a triangular triplet exists or False
if not.
6
10 2 5 1 8 20
True