Cod sursa(job #2286619)

Utilizator I_am_not_a_robotMr Domino I_am_not_a_robot Data 20 noiembrie 2018 16:17:29
Problema Aria Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.58 kb
#include <bits/stdc++.h>

using namespace std;

const int N=100000+5;

struct point
{
    double x;
    double y;
};

inline double trapez(point a,point b)
{
    return (a.y+b.y)*(a.x-b.x);
}

double ans;

int main()
{
    freopen("aria.in","r",stdin);
    freopen("aria.out","w",stdout);
    int n;
    cin>>n;
    point F,L;
    cin>>F.x>>F.y;
    L=F;
    for(int i=2;i<=n;i++)
    {
        point now;
        cin>>now.x>>now.y;
        ans-=trapez(now,L);
        L=now;
    }
    ans-=trapez(L,F);
    ans*=0.5;
    cout<<ans<<"\n";
    return 0;
}