AlgoUniversity
  • Go Back
Discussion
Pythagorean Theorem :

Author

Akshay Sharma

Difficulty Level : Medium

Submissions : 56

Asked In : HCL

Marks :100

: 0 | : 0

You are given two integer A and B represent a coordinate on the x-axis(0,A) and B represent a coordinate on the y-axis(B,0).

These are two coordinate points on a right-angled triangle, the third point begins the origin(0,0). You will be given N such triangles in the input. Find out and print the length of the hypotenuse of all triangles.

Input

The first line contains integer N denoting the number of triangles. ($$$1 \le N \le 10^4$$$).

The next N line contains two space-separated integers representing A and B respectively($$$1 \le A,B \le 10^9$$$).

Output

Each line represents the length of the hypotenuse of the ith triangle.

Example

Input
3
20 21
8 15
2 3
Output
29
17
4

Note

The formula for the length of hypotenuse = root(a^2+b^2) where a and b represent the length of the other two sides of the triangle.

If the length of the hypotenuse is in the decimal round it is to the next greater integer.

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.