Cod sursa(job #2358300)

Utilizator Andrei-27Arhire Andrei Andrei-27 Data 27 februarie 2019 23:17:08
Problema Aria Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.56 kb
#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 ) ;

}