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

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

hide comments
2016-04-30 11:20:28
Nice prob!
2016-03-14 16:34:21
c++ one shot:) took some time to understand logic..bt very simple
2015-10-11 09:04:47 kamran siddique
BigInteger works AC in one go :)
2015-04-29 14:00:45 Luis Manuel Díaz Barón
Accepted at the first attempt
2013-12-27 10:00:25 Ankit Kumar
<snip>
can anyone suggest any test case for which it can fail?

Last edit: 2022-06-27 11:49:22
2013-10-17 09:38:01 Anant Kumar
easy geometry..
2013-05-28 14:36:31 mystique_blue
Why is C++ blocked??
2013-03-11 12:54:37 Ouditchya Sinha
Nice problem... :)
2012-11-12 15:41:56 Một Bạn Trai Giấu Tên
30 test cases takes 1.036s java BigInteger
2011-08-17 12:56:40 amit
take array
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.