Cod sursa(job #2460827)

Utilizator andrei42Oandrei42O andrei42O Data 24 septembrie 2019 15:49:30
Problema Aria Scor 10
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.38 kb
#include <bits/stdc++.h>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
const int N = 100010;
int n;
long double x[N],y[N],aria;
int main()
{
    f >> n ;
    for(int i=1;i<=n;i++)
        f>>x[i]>>y[i];
    x[0]=x[n];
    y[0]=y[n];
    for(int i=1;i<=n;i++)
        aria+=(x[i-1]-x[i])*(y[i-1]+y[i]);
    aria/=2.0;
    g<<aria;
    return 0;
}