Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Window Seats on a Bus

By whoisshihab · Limits 1s, 512 MB

Karim is traveling by bus. He has the window seat. However, he has to share the window with the passengers sitting in front of him.

This can be a real problem, as in these buses the window panes slide back and forth. And more often, it happens that if passengers in one row of the bus want to keep their part of the window open, they end up closing the portion of the window for the passengers behind.

Unfortunately, for Karim, that was the exact thing happening. Every time he tried to open the window on his part, the passengers in front would just slide it close trying to keep their part as open as possible.

Struggling to get some fresh air on a bus packed with people, he turns to you for help.

You decide that the only fair solution to this is to keep the windows panes at the exact center of the window frame.

You know the length of the frame (L), width of the frame (W), distance from bottom-left corner to bottom-right corner of one window (D). You have to find out the area of the free frame Rahim (or the passengers in front) will get if they place the panes at the middle of the frame.


1st line of the input will contain an integer T (1 ≤ T ≤ 20) denoting number of test cases. Each test case contains three numbers L (0 < L ≤ 100), W (0 < W ≤ 100) and D (0 < D ≤ 100).


For each test case, print “Case X: Y” (without quotes) where X is the test case and Y is a number with exactly two digits after the decimal point, denoting the area of free frame anyone of the passengers will get. Print a newline after each test case.


11 7.65 2
20 10.001 3.3
Case 1: 31.08
Case 2: 67.01

Both window panes have the same length and width. The window has the same length as the frame.



100% Solution Ratio

flash_7Earliest, Aug '17

rakibhassanFastest, 0.0s

Mili290Lightest, 0 B

touhidurShortest, 101B


Login to submit

Related Contests