Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Pythagoras Rocks

Limits 1s, 512 MB

Most of us were introduced with Pythagoras’s theorem back at the high school. It states a simple yet fascinating fact about right triangles. A right triangle is a triangle, in which one of the angles is 90 degrees. Pythagoras’s theorem says, for right triangle, the following formula holds:

Here, c is the length of the hypotenuse and a and b are the length of the other two sides. If a, b and c are all integers, then together they are called a Pythagorean triple.

In this problem, you will be given a Pythagorean triple, you will have to answer the length of the hypotenuse from the given triple.


The only input line contains three integers X, Y and Z ( 1 ≤ X,Y,Z ≤ 109 ), the three sides of a Pythagorean triangle.


The output contains one integer, the length of the hypotenuse of the given triangle.


3 4 5
5 12 13



93% Solution Ratio

fsshakkhorEarliest, Dec '16

Mr.adnanFastest, 0.0s

nishat19Lightest, 0 B

touhidurShortest, 36B


Login to submit

Related Contests

SUB Intra University Programming Contest 2016 Ended at 2016-11-23 10:40:00 +0000 UTC
Intra KUET Programming Contest 2016 Ended at 2016-12-24 10:20:00 +0000 UTC
Replay of SUB Intra University Programming Contest 2016 Ended at 2016-12-31 17:00:00 +0000 UTC
BRACU Intra Programming Contest Fall 2018 (Junior) Ended at 2018-09-28 12:30:00 +0000 UTC
JnU Intra-Department Programming Contest 2018 (Junior Division) Ended at 2018-10-02 06:00:00 +0000 UTC