Submit | All submissions | Best solutions | Back to list |
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
|
||||||||||||||
2014-10-13 17:33:49 Vamsi Krishna Avula
radius as given in question is just integer, no float values are given. Last edit: 2015-01-13 14:15:41 |
||||||||||||||
2014-09-19 10:08:23 vikax
easy one simple math....... |
||||||||||||||
2014-09-18 23:15:25 Saurabh Shukla
Basic maths.Took me back to the good old days of my high school :) |
||||||||||||||
2014-09-05 12:16:01 funky
wtf!! got 2 wa for case instead of Case |
||||||||||||||
2014-09-03 17:19:32 eightnoteight
very very simple question... |
||||||||||||||
2014-08-30 12:49:10 surayans tiwari(http://bit.ly/1EPzcpv)
+0.25 easiest ques |
||||||||||||||
2014-08-17 22:28:43 ashish jaiswal
@ravi thanx bro..i did d same mistake twice |
||||||||||||||
2014-08-16 22:27:05 ravi
use calculus to derive formula... case instead of Case caused me 3 WA... |
||||||||||||||
2014-08-10 22:41:06 rituraj
there is a simple sequence in the outputs... :) for 2 its 16.25 catch it if you can :p |
||||||||||||||
2014-08-09 20:23:50 mohsin mohammad
Can anyone help me? |