Cod sursa(job #1921970)
Utilizator | bogdan bancuta bogdi1 | Data | 10 martie 2017 15:31:38 |
---|---|---|---|
Problema | Aria | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.48 kb |
#include <cstdio>
#include <cmath>
using namespace std;
const int eps = 1.e-14;
int main()
{ freopen("aria.in", "r",stdin);
freopen("aria.out", "w",stdout);
double x1,y1,x2,y2,a,x3,y3;
int i,n;
scanf("%d", &n);
scanf("%lf%lf", &x1, &y1);
x3=x1;
y3=y1;
for(i=2; i<=n;i++){
scanf("%lf%lf", &x2, &y2);
a+=(x1*y2)-(x2*y1);
x1=x2;
y1=y2;
}
a+=(x1*y3)-(x3*y1);
a/=2.0;
a=fabs(a);
printf("%.6lf", a);
return 0;
}