Cod sursa(job #1185763)

Utilizator robertstrecheStreche Robert robertstreche Data 16 mai 2014 20:07:13
Problema Aria Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.4 kb
#include <fstream>

using namespace std;

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

int n,i,y,x,y1,x1,yt,xt;
long long s;

int main()
{
    f>>n;

    f>>x1>>y1;

    xt=x1;yt=y1;

    for (i=2;i<=n;i++)
     {
         f>>x>>y;

         s+=xt*y-yt*x;

         xt=x;yt=y;
     }

     s+=xt*y1-x1*yt;

     s>0?(g<<s/2):(g<<-s/2);

    f.close();
    g.close();
}