MAXLN - THE MAX LINES

no tags 

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

hide comments
Harsh Vardhan Ladha: 2015-08-11 21:20:29

WA in python in all attempts
AC in cpp in a go.
-.-

Arif Awate: 2015-08-09 19:20:05

hahahaha... totally funny problem... first of all to make it clear... the problem has no flaw... try running your code for r = 1000000, and your problem might be solved...

darkhire21: 2015-08-08 18:59:32

give space after Case_1:_ 4.25

Mohit Rathore: 2015-08-04 13:10:19

No floats, no doubles. Just plain simple int will do the trick if you do it right ;)

sukriti_verma: 2015-08-01 23:49:00

int radius gave WA
float radius gave WA
double gives AC -.-

Shreyas Dixit: 2015-07-21 21:42:18

basic trigonometry

Last edit: 2015-07-21 21:42:49
ROHIT Kumar: 2015-07-12 16:11:13

can anybody tell why it was not working with
float...

Last edit: 2015-07-12 16:22:54
ROHIT Kumar: 2015-07-12 16:08:30

ac
after 5 wa..use double...

Last edit: 2015-07-12 16:22:12
Shantanu Banerjee: 2015-07-03 07:02:40

This stupid Ques caused me 5 WA's, Hell Frustated,
WA in C
AC in C++

r0bo_dart: 2015-06-18 11:05:34

Damn easy question. Don't waste time here.


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)