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
:):
2012-06-13 07:11:51
oh no i am getting TLE..used %Lf for answer and long long int for radius then also |
|
gabber:
2012-04-17 08:47:09
very easy just see the output formatting cost me three wa |
|
Darky:
2012-04-14 16:19:39
Somehow python gives wrong answer to this one. |
|
(Tjandra Satria Gunawan)(曾毅昆):
2012-03-24 18:20:53
i can solve this problem without using floating point or double... just integer with few math tricks :) |
|
ginnipkj:
2012-03-11 16:17:59
i totally agree with JVR
|
|
rohitjv:
2012-02-11 10:59:38
take care of the data types......i costed me many errors |
|
Jakub ©afin:
2012-01-02 19:32:58
Anyway, a testcase can be solved in constant time... the math behind it is nice and simple |
|
fandi a rahadian:
2011-11-30 11:40:32
why im getting TLE? lol. what will make me TLE, anybody please help |
|
MR. BEAN :
2011-10-19 13:46:15
simple differencial application!!! |
|
magicsquare:
2011-10-19 08:41:28
tutorial for sure!
|
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) |