MAXLN - THE MAX LINES

In this problem you will be given a half-circle. The half-circle’s radius is r. You can take any point A on the half-circle and draw 2 lines from the point to the two sides of the diameter(AB and AC). Let the sum of square of one line’s length and the other line’s length is s

Like in the figure s = AB2 + AC. And BC = 2r.

Now given r you have to find the maximum value of s. That is you have to find point A such that AB2 + AC is maximum.

Input

First line of the test case will be the number of test case T (1 <= T <= 1000). Then T lines follows. On each line you will find a integer number r (1 <= r <= 1000000); each representing the radius of the half-circle.

Output

For each input line, print a line containing "Case I: ", where I is the test case number and the maximum value of s. Print 2 digit after decimal (Errors should be less then .01).

Example

Sample Input:
1
1

Sample Output:
Case 1: 4.25

Added by:Muhammad Ridowan
Date:2011-03-28
Time limit:1s-1.679s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own Problem(used for CSE,University of Dhaka, Newbies Contest)

hide comments
2015-05-30 14:18:49
stupid question
2015-04-29 03:50:31 BRAIN
4 * r * r + 0.25 ( using floating point )
2015-04-20 22:46:05 _R0b_
is it my answer's correct format ?
3
1
Case 1: 4.25
1000
Case 2: 4e+06
100000
Case 3: 4e+10
2015-04-18 19:05:20 NIKHIL KUMAR SINGH
Don't know that ....When i submitted in python got 4 WA's and AC in one go in C++
2015-04-01 20:23:34 burninggoku
iss prashan ne toh hume 12 kaksha ki yaad dilla di...waah......
2015-03-26 20:26:21 Dushyant Singh
Take radius as long long. Costed me many WA. -_-
2015-02-05 14:29:11 Andrey Kaygorodov
The input is correct. There is only integers values.
2015-02-05 13:03:19 LeppyR64
The input is definitely all in the set of integers.
2015-02-05 01:28:03 Francky
According to my tests there's some '.' in input, but reading input as integer leads to AC with my code.
Edit : using Python !

Edit : My test was wrong, as some input lines have only one char, and "assert '.' not in line" gave NZEC in such cases.
"assert '.' not in list(line)" didn't give me NZEC, so there's no '.' in input.
My conclusion, like Mitch, is that input is well formatted.
Last edit : the real reason for my NZEC is not that some lines have only one char ; it was due to my curious way of reading input on that old code.

Last edit: 2015-02-05 13:16:41
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.