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
rohan2802:
2017-01-15 22:07:59
Be careful of the output format.The 'C' in case is capital.Cost me 7 wa........ |
|
aronzx:
2017-01-01 18:40:08
My 50th ! |
|
kira28:
2016-12-14 22:30:41
AC by hook or crook... |
|
shantanu_sarin:
2016-12-14 14:31:07
mathematical concept required......
|
|
asgupta_spoj:
2016-12-04 09:28:14
care of format of output required.
|
|
E Naveen Kumar:
2016-11-09 11:57:02
REMEMBER ans should be in format "Case I: ans"
|
|
wompowe:
2016-10-31 08:55:27
when you add that "fixed number" to the value of computed number,it gives WA but when you just print it it gives AC. Don't know why |
|
roopansh:
2016-09-27 19:52:39
one WA for not printing "Case :".. took radius as double
|
|
karan_batra:
2016-08-29 14:11:34
AC in one go :D. Comments do help. Take r as double. |
|
tni_mdixit:
2016-08-26 14:25:12
Case costed me 2 WA no diff needed just trigy :P
|
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) |