http://acm.pku.edu.cn/JudgeOnline/problem?id=1862
1 #include<iostream>
2 #include<cmath>
3 #include<iomanip>
4 using namespace std;
5 void sort(double a[],int n)
6 {
7
8 double temp;
9
10 int p,q;
11
12 for(p=1;p<n;p++)
13
14 for(q=p+1;q<=n;q++)
15
16 if(a[p]<a[q])
17
18 {
19
20 temp=a[q];
21
22 a[q]=a[p];
23
24 a[p]=temp;
25
26 }
27
28 }
29
30 int main()
31
32 {
33
34 double i[102],key=1;
35
36 int j,k;
37
38 cin>>k;
39
40 for(j=1;j<=k;j++)
41
42 cin>>i[j];
43
44 if(k==1)
45 cout<<fixed<<setprecision(3)<<i[1]<<endl;
46
47 else
48
49 {
50
51 sort(i,k);
52
53 key=2*sqrt(i[1]*i[2]);
54
55 for(j=3;j<=k;j++)
56
57 key=2*sqrt(key*i[j]);
58
59 cout<<fixed<<setprecision(3)<<key<<endl;
60
61 }
62
63 }
64
65