Cod sursa(job #2790752)

Utilizator IDKnow1710Cosovanu gabriel IDKnow1710 Data 29 octombrie 2021 14:07:33
Problema Aria Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.39 kb
#include <bits/stdc++.h>

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

int main()
{
    int n,i;
    double long  x,y,x1,y1,x2,y2,s=0;
    f>>n;
    f>>x2>>y2;
    x1=x2;
    y1=y2;
    for(i=2;i<=n;i++)
    {
   f>>x>>y;
   s+=x1*y-x*y1;
   x1=x;
   y1=y;

    }
  s+=x1*y2-y1*x2;
    g << fixed << setprecision (5) << abs(s/2);

    return 0;
}