POJ 1862
#include <iostream> #include <algorithm> #include <iomanip> #include <cmath> #define MAXN 100 using namespace std; double _m[MAXN]; double fun(); int n; int main() { //freopen("acm.acm","r",stdin); int i; cin>>n; for(i = 0; i < n; ++ i) { cin>>_m[i]; } double tem = fun(); for(i = 1; i < n; ++ i) { tem = 2*sqrt(fun()*tem); } cout<<setiosflags(ios::fixed)<<setprecision(3)<<tem<<endl; } double fun() { int i; double max = -1; int index; for(i = 0; i < n; ++ i) { if(_m[i] > max) { max = _m[i]; index = i; } } _m[index] = -1; return max; }
关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。
技术网站地址: vmfor.com