Cod sursa(job #1921908)
| Utilizator | Data | 10 martie 2017 15:20:28 | |
|---|---|---|---|
| Problema | Aria | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.49 kb |
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
freopen( "aria.in", "r", stdin );
freopen( "aria.out", "w", stdout );
int n, i;
double a=0, x, y, x1, y1, x2, y2;
scanf( "%d%lf%lf", &n, &x, &y );
x1=x;
y1=y;
for( i=2;i<=n;i++ )
{
scanf( "%lf%lf", &x2, &y2 );
a+=(x1-x2)*(y1+y2);
x1=x2;
y1=y2;
}
a=fabs(a+(x1-x)*(y1+y))/2;
printf( "%.5lf", a );
return 0;
}
