| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
再水不过如此,20分钟一A水过。。。附代码#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
#define MAX 101
double weight[MAX];
int n;
bool cmp(int a, int b) { return a > b; }
int main()
{
scanf("%d", &n);
int i;
for(i = 0; i < n; i ++) scanf("%lf", &weight[i]);
for(i = 0; i < n - 1; i ++)
{
sort(weight + i, weight + n, cmp);
weight[i + 1] = 2 * sqrt(double(weight[i] * weight[i + 1]));
}
printf("%.3lf\n", weight[n - 1]);
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator