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
hide comments
Mitch Schwartz:
2015-02-04 21:36:47
Input is fine according to my test. Stop spreading misinformation. |
|
Scott Shepherd:
2015-02-04 16:38:41
Like others here, I got WA when I assumed integer radius, and AC when I considered it floating-point.
|
|
bharat:
2015-01-28 21:06:31
taking radius in double instead of long
|
|
Raj Kumar Chauhan:
2015-01-23 19:24:02
easy one :) |
|
Shivam kumar :
2015-01-23 16:07:37
test case consists of only integer. |
|
Arnabjyoti Kalita:
2015-01-18 07:49:28
take care of the inputs...
|
|
sathya_dev:
2014-12-29 06:54:58
Hi.. Test Case contains float value. Use float. Cost me a WA. |
|
Anuj Agrawal:
2014-12-25 10:45:33
Notice a space after the colon ,costed me WA Last edit: 2014-12-25 10:48:11 |
|
Chinmaya Kumar Patanaik:
2014-12-20 20:16:40
Changed radius from int to double...and it worked..inputs in the question could have been more clear. Last edit: 2014-12-20 20:17:05 |
|
Samarth Kothari:
2014-12-16 04:40:57
It definitely has float radius!!! Last edit: 2014-12-16 04:41:22 |
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) |