Cod sursa(job #1817252)

Utilizator CodrutLemeniCodrut Lemeni CodrutLemeni Data 27 noiembrie 2016 15:43:15
Problema Aria Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.57 kb
#include <iostream>
#include <stdio.h>

using namespace std;

int main(){
    int n , i;
    double xst , yst , x , y, xprec , yprec ;
    double s;

    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 ;


    printf("%.5lf", s/2 );

    return 0;
}