B. Olympus Medal

Source: Internet
Author: User
Time limit per test

2 seconds

Memory limit per test

256 megabytes

Input

Standard Input

Output

Standard output

The world programming Olympus medal is a metal disk, consisting of two parts: the first part is a ring with outer radiusR1 cm,
Inner radiusR2 cm, (0 bytes <averageR2 bytes <averageR1) made
Of metal with densityP1g/cm3.
The second part is an inner disk with radiusR2 cm,
It is made of metal with densityP2g/cm3.
The disk is nested inside the ring.

The Olympus jury decided thatR1 will
Take one of possible valuesX1, bytes,X2, middle..., middle ,...,XN.
It is up to jury to decide which particle ValueR1 will
Take. Similarly, the Olympus jury decided thatP1 will
Take one of possible valueY1, bytes,Y2, middle..., middle ,...,YM,
AndP2 will
Take a value from ListZ1, bytes,Z2, middle..., middle ,...,ZK.

According to most initialize ent traditions the ratio between the outer ring massMOutAnd
The inner disk massMInMust
Equal,
WhereA, Bytes,BAre constants taken from your ent books. Now, to start making medals, the jury needs to take valuesR1,P1,P2 and
Calculate the suitable valueR2.

The jury wants to choose the value that wocould maximize radiusR2.
Help the jury find the sought valueR2.
ValueR2 doesn' t
Have to be an integer.

Medal has a uniform thickness throughout the area, the thickness of the inner disk is the same as the thickness of the outer ring.

Input

The first input line contains an integerNAnd a sequence of IntegersX1, bytes,X2, middle..., middle ,...,XN.
The second input line contains an integerMAnd a sequence of IntegersY1, bytes,Y2, middle..., middle ,...,YM.
The third input line contains an integerKAnd a sequence of IntegersZ1, bytes,Z2, middle..., middle ,...,ZK.
The last line contains two integersAAndB.

All numbers given in the input are positive and do not exceed 5000. Each of the three sequences contains distinct numbers. The numbers in the lines are separated by spaces.

Output

Print a single real number-The sought ValueR2
Absolute or relative error of at most 10 rows-errors 6.
It is guaranteed that the solution that meets the problem requirements exists.

Sample test (s) Input
3 1 2 31 23 3 2 11 2
Output
2.683281573000
Input
4 2 3 6 42 1 23 10 6 82 1
Output
2.267786838055
Note

In the first sample the jury shoshould choose the following values:R1 rows = rows 3,P1 rows = second 2,P2 bytes = bytes 1.

Problem solving Description: this is to find the maximum radius that meets the conditions, and use greedy and mathematical formulas to solve the problem.

#include <iostream>#include<algorithm>#include<cstdio>#include<cmath>#include<cstring>using namespace std;int main(){int x,i,r1=0,a,p1=0,p2,y,z;scanf("%d",&x);for(i=1;i<=x;i++){scanf("%d",&a);if(a>r1){r1=a;}}scanf("%d",&x);for(i=1;i<=x;i++){scanf("%d",&a);if(a>p1){p1=a;}}scanf("%d%d",&x,&p2);for(i=1;i<x;i++){scanf("%d",&a);if(a<p2){p2=a;}}scanf("%d%d",&y,&z);double j=(double)y/z;double r2=r1/pow((((j*p2)/p1)+1),0.5);printf("%lf",r2);return 0;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.