/**********
author:chanjun2016
email:15755396353@163.com
***********/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
#define INF = 0x3f3f3f3f
int main(){
int n;
while (scanf("%d",&n), n > 0){
double xa,ya,xb,yb;
scanf("%lf%lf%lf%lf",&xa,&ya,&xb,&yb);
double L = 0.0;
double subarea = 0.0, e;
for (int i = 0; i < n; ++i){
scanf("%lf",&e);
L += e;
subarea += e * e / 2;
}
double k1 = ya / xa, k2 = yb / xb;
if (k1 > k2){
swap(k1,k2);
}
double x1 = (k2 + 1) / (k2 - k1) * L;
double x2 = (k1 + 1) / (k2 - k1) * L;
double y1 = k1 * x1, y2 = k2 * x2;
double ans = abs(x1 * y2 - x2 * y1) / 2 - subarea;
printf("%.3lf\n",ans);
}
return 0;
}
uva1643
最新推荐文章于 2019-10-20 18:34:28 发布