Pagini recente » Cod sursa (job #2657399) | Cod sursa (job #1109286) | Cod sursa (job #2285608) | Cod sursa (job #2726827) | Cod sursa (job #2358300)
#include <bits/stdc++.h>
using namespace std;
ifstream in ("aria.in") ;
ofstream out ("aria.out") ;
const int NR = 100004 ;
struct point
{
long double x , y ;
}p [ NR ];
int n , i ;
double s ;
int main()
{
in >> n ;
for ( i = 1 ; i <= n ; ++ i )
in >> p [ i ].x >> p [ i ].y ;
p [ n + 1 ].x = p [ 1 ].x , p [ n + 1 ].y = p [ 1 ].y ;
for ( i = 1 ; i <= n ; ++ i )
s += p [ i ].x * p [ i + 1 ].y - p [ i ].y * p [ i + 1 ].x ;
s = max ( s , -s ) ;
out << fixed << setprecision ( 7 ) << ( s / 2.0 ) ;
}