Cod sursa(job #1817635)
| Utilizator | Data | 28 noiembrie 2016 10:42:04 | |
|---|---|---|---|
| Problema | Aria | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.6 kb |
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
int n , i;
double xst , yst , x , y, xprec , yprec ;
long double s = 0;
freopen("aria.in","r",stdin);
freopen("aria.out","w",stdout);
scanf("%d",&n);
scanf("%lf%lf",&xst,&yst);
xprec = xst;
yprec = yst;
for ( i = 1 ; i < n ; i++ ){
scanf("%lf%lf",&x,&y);
s += ( xprec * y ) - yprec * x;
xprec = x ;
yprec = y ;
}
s += ( xprec * yst) - yprec * xst ;
cout<< s/2 ;
// printf("%.5Lf", s/2 );
return 0;
}
