Cod sursa(job #2021616)

Utilizator dumitrescu_andreiDumitrescu Andrei dumitrescu_andrei Data 14 septembrie 2017 00:28:50
Problema Aria Scor 10
Compilator cpp Status done
Runda Arhiva educationala Marime 0.39 kb
#include <bits/stdc++.h>

using namespace std;

ifstream f("aria.in");
ofstream g("aria.out");

struct punct{

double x,y;

}a[100100];

int n;

double S;

int main()
{

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

    a[0]=a[n];
    a[n+1]=a[1];

    for(int i=1;i<=n;++i)
        S=S+a[i].x*(a[i+1].y-a[i-1].y);

    g<<abs(S)/2;

    return 0;

}