Back
Close

Is a triangle

Statement

 Goal

Given the length of three sides of a triangle, if it is a valid triangle output the perimeter of the triangle, otherwise output -1. Degenerate triangles are not considered valid for this clash.
Input
Line 1 Integer A first side of triangle
Line 2 Integer B second side of triangle
Line 3 Integer C third side of triangle
Output
Line 1 if the sides make a valid triangle, output the perimeter, else output -1
Constraints
0 <= A, B,C <= 100
Example
Input
1
2
3
Output
-1

Game modes
Fastest, Shortest

Test cases
Test 1 Test
Input
1 2 3
Output
-1

Validator 1 Validator
Input
1 2 2
Output
5

Test 2 Test
Input
2 2 2
Output
6

Validator 2 Validator
Input
2 2 4
Output
-1

Test 3 Test
Input
1000 1 2
Output
-1

Validator 3 Validator
Input
1 1000 2
Output
-1

Test 4 Test
Input
30 29 27
Output
86

Validator 4 Validator
Input
29 30 27
Output
86

Solution language

Solution

Stub generator input