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
exesharkx: 2019-04-12 11:58:05

C++ boost Library

Last edit: 2019-04-12 11:58:17
imkiller: 2018-06-03 19:25:07

java bigInteger success.. got error in python

shreeshiv: 2017-07-26 15:33:08

infant do in python, boys do in java ,legends do in c++,c

rayhan50001: 2017-02-26 16:51:16

BigInteger Java ... ac in one go.

fmakruf: 2017-01-19 11:41:06

got ac in one go with python :)

aditya_rev: 2016-11-09 17:56:05

big number is big problem in c ;((

Maciej Misiak: 2016-10-11 23:21:32

Some condition is missing for the task. There is more than one proper answer, e.g. for 3 8 5 right answer could be 16 as well (distance between b and c == 1). Should one find shortest a or what?

poda_venna: 2016-08-27 22:00:34

6 line python woooot

shashisuman: 2016-07-03 12:44:16

BigInteger pooooooooooooooooooooo

sudoankit: 2016-05-28 17:37:30

Nice Problem.


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