Cod sursa(job #2309467)

Utilizator NToniBoSSNicolae Tonitza NToniBoSS Data 29 decembrie 2018 00:41:23
Problema Aria Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.97 kb
#include <bits/stdc++.h>
#define LIM 1<<17
#define x first
#define y second
/// TONI BO$$ was here
/// #MLC

using namespace std;
char BUF[LIM];
int poz;

inline char getChar(){
    poz++;
    if(poz>=LIM){
    	fread(BUF,LIM,1,stdin);
    	poz=0;
    }
    return BUF[poz];
}

inline int getNr(){
    int r=0, semn=1;
    char ch=getChar();
    while(isdigit(ch)==0 && ch!='-') ch=getChar();
    if(ch=='-'){
        semn=-1;
        ch=getChar();
    }
    while(isdigit(ch)!=0){
        r=r*10+semn*(ch-'0');
        ch=getChar();
    }
    return r;
}
pair <int,int> v[100001];
int main()
{
    int n,i,j;
    freopen("aria.in","r",stdin);
    freopen("aria.out","w",stdout);
    n=getNr();
    long long s=0;
    for(i=0; i<n; i++)
    {
        v[i].x=getNr();
        v[i].y=getNr();
    }
    for(i=0; i<n; i++)
    {
        j=(i+1)%n;
        s+=(v[i].x*v[j].y-v[i].y*v[j].x);
    }
    printf("%lf",(double)s/2);

    return 0;
}