Cod sursa(job #1609185)

Utilizator shpincCandrea Laurentiu Vasile shpinc Data 22 februarie 2016 17:31:59
Problema Aria Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.55 kb
#include <bits/stdc++.h>

using namespace std;
const int L = 1e5 + 5;
ifstream f("aria.in");
ofstream g("aria.out");
struct C{

    int x,y;

};
C p[L];
 long double s, n;

int main()
{

    f>>n;
    for(int i = 1; i<= n; i++)
        f>>p[i].x>>p[i].y;
    for(int i = 1; i<= n; i++){

        if(i == n)
        {
            p[i+1].x = p[1].x;
            p[i+1].y = p[1].y;

            }
        s+= p[i].x*p[i+1].y-p[i+1].x*p[i].y;

    }
    g<<fixed<<setprecision(6)<<(long double)s/(long double)2;


    return 0;
}