标签:
Description
Input
Output
Sample Input
3 72 30 50
Sample Output
120.000
#include <stdio.h> #include <math.h> #include <algorithm> using namespace std; int cmp(int a,int b) { return a>b; } int main() { int n; while(scanf("%d",&n)!=EOF) { double m,a[103]; for(int i=0; i<n; i++) { scanf("%lf",&a[i]); } sort(a,a+n,cmp); for(int i=0;i<n-1;i++) { a[i+1] =2.0*sqrt(a[i]*a[i+1]); } printf("%.3lf\n",a[n-1]);//特别注意是输出最后一个 而不是a[i+1] //当n=1时,i+1就是0; } return 0; }
标签:
原文地址:http://www.cnblogs.com/tianmin123/p/4638198.html