Cod sursa(job #2570322)

Utilizator cyg_Alex_codegicianBarbu Alexandru cyg_Alex_codegician Data 4 martie 2020 16:09:19
Problema Aria Scor 100
Compilator cpp-64 Status done
Runda r3capitusulare Marime 0.5 kb
#include <fstream>
#include <iomanip>
using namespace std;
ifstream fin ("aria.in");
ofstream fout ("aria.out");
const int nmax=100005;
int main()
{
    int n;
    fin >> n;
    long double rez=0;
    pair <long double,long double> pct[nmax];
    for (int i=1;i<=n;i++)
    {
        fin >> pct[i].first >> pct[i].second;
    }
    pct[n+1]=pct[1];
    for (int i=1;i<=n;i++)
    {
        rez=rez+pct[i].first*pct[i+1].second-pct[i+1].first*pct[i].second;
    }
    fout << fixed << setprecision(6) << rez/2;
}