407510: GYM102821 B Bin Packing

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Bin Packingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Packing items into a bin is well known as packing problem, and Fish is studying it too. As a beginner, he starts with $$$2$$$-dimension-version problem with $$$2$$$ rectangle-shape items. He just wants to find a convex polygon with the smallest area so that these two items can be well included in it. You should notice that these two items can not overlap each other and you can shift or rotate them in the plane if you like.

Please help Fish solve the problem.

Input

The first line of input contains an integer $$$T$$$, representing the number of test cases. Then following $$$T$$$ lines, each line representing one test case.

For each test case there are four integers $$$w_1, h_1, w_2, h_2$$$ separated by one space telling the width and length of these two items respectively.

Output

For each test case, you should output Case $$$x$$$: $$$y$$$ in one line, where $$$x$$$ indicates the case number starting from $$$1$$$ and $$$y$$$ represents the smallest area.

Your answers will be consider correct if its absolute error does not exceed $$$10^{-6}$$$.

ExampleInput
2
1 3 2 4
2 3 4 5
Output
Case 1: 11.5
Case 2: 27.0
Note

$$$1 \le T \le 100$$$

$$$1\le w_1, h_1, w_2, h_1 \le 100$$$

加入题单

上一题 下一题 算法标签: