GEOPROB - One Geometry Problem


This is a problem of Euclidean Geometry. See the figure below.

Your task is as follows: given the lengths of segments b, c, and d, calculate the length of segment a.

Input

The input begins with the number t of test cases in a single line (t<=300). In each of the next t lines there are three integers b, c and d (0 <= b, c and d <= 10200 ; b,d < c) separated by a space.

Output

For every test case print the length of the segment a, one number per line.

Example

Input:
2
3 8 5
10 18 12

Output:
8
14

hide comments
mohd_sharique: 2016-04-30 11:20:28

Nice prob!

vikash1143: 2016-03-14 16:34:21

c++ one shot:) took some time to understand logic..bt very simple

kamran siddique: 2015-10-11 09:04:47

BigInteger works AC in one go :)

Luis Manuel Díaz Barón: 2015-04-29 14:00:45

Accepted at the first attempt

Ankit Kumar: 2013-12-27 10:00:25

<snip>
can anyone suggest any test case for which it can fail?

Last edit: 2022-06-27 11:49:22
Anant Kumar: 2013-10-17 09:38:01

easy geometry..

mystique_blue: 2013-05-28 14:36:31

Why is C++ blocked??

Ouditchya Sinha: 2013-03-11 12:54:37

Nice problem... :)

Một Bạn Trai Giấu Tên: 2012-11-12 15:41:56

30 test cases takes 1.036s java BigInteger

amit: 2011-08-17 12:56:40

take array


Added by:Frank Rafael Arteaga
Date:2008-07-30
Time limit:1s
Source limit:4000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:ADA95 ASM32 BASH BF C CSHARP CPP C99 CLPS LISP sbcl LISP clisp D FORTRAN HASK ICON ICK JAVA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON RUBY SCM guile SCM qobi ST TEXT WHITESPACE
Resource:My own Resource