Submit | All submissions | Best solutions | Back to list |
HS09CUT - Cutting out rectangles |
We are given some scrap gold pieces shaped as in Picture 1. Dimensions A,B,C,D are given in millimeters. A rectangle, having the largest possible area, is now cut out from this piece. Calculate the area which is left after cutting out such a rectangle.
Input
Standard input contains N (2 ≤ N ≤ 20 000) lines, each containing four values A,B,C,D (0 ≤ C ≤ A ≤ 100 000 000, 0 ≤ D ≤ B ≤ 100 000 000) separated by spaces. In line N+1 there are four zeros separated by spaces. Do not process this test case.
Output
Write N lines to standard output. Each should contain a single number, equal to the area in square millimeters which is left after cutting out the largest rectangle possible. The relative error of your result should not exceed 0.000001.
Example
Input:11 10 3 6
12 10 2 4
0 0 0 0
Output:
28.00
37.733333
Scoring
For solving this problem you will score 10 points.
Added by: | Adam Dzedzej |
Date: | 2009-10-17 |
Time limit: | 0.200s |
Source limit: | 50000B |
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 JS-RHINO LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON RUBY SCM guile SCM qobi ST TCL TEXT WHITESPACE |
Resource: | High School Programming League (thanks to Talent Association) |