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-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? |
||||||||||||||
2014-07-30 11:06:38 karan
question says test radius are integer but it contains float as well..@admin correct the question |
||||||||||||||
2014-07-08 13:20:15 Samar Holkar
simple math....no need of calculus... |
||||||||||||||
2014-06-27 16:40:26 Abhishek Kumar
just basic maths..!!!..although got AC in 4th times bcoz of wronlgy taken word "case"...itz better u take care of this word..!! Last edit: 2014-06-27 16:41:15 |
||||||||||||||
2014-06-03 05:40:19 shreya sahu
was missing endl... caused me 3 WA :-p |
||||||||||||||
2014-05-28 02:43:29 arunrjit
WTF? test cases also contain float value of radius |
||||||||||||||
2014-05-20 14:07:40 pvkcse
four lines of code in python but printing case causes 6 WA...finally got AC...!!! |