Cod sursa(job #1414677)

Utilizator irimiecIrimie Catalin irimiec Data 2 aprilie 2015 21:15:32
Problema Aria Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 1.08 kb
#include <bits/stdc++.h>

using namespace std;

#define     mp              make_pair
#define     fs              first
#define     sc              second
#define     pob             pop_back
#define     pub             push_back
#define     eps             1E-7
#define     sz(a)           a.size()
#define     count_one       __builtin_popcount;
#define     count_onell     __builtin_popcountll;
#define     fastIO          ios_base::sync_with_stdio(false)
#define     PI              (acos(-1.0))
#define     linf            (1LL<<62)//>4e18
#define     inf             (0x7f7f7f7f)//>2e9

#ifndef ONLINE_JUDGE
ifstream fin("aria.in");
ofstream fout("aria.out");
#endif

const int MAXN = 100010;

int n;
pair<double, double> v[MAXN];

void read() {
	fin >> n;

	for(int i = 0; i < n; ++i) {
	    fin >> v[i].fs >> v[i].sc;
	}
	v[n] = v[0];

	double ans = 0.0;
	for(int i = 0; i < n; ++i) {
        ans += (v[i].fs * v[i+1].sc - v[i+1].fs * v[i].sc);
	}

	fout << fixed << setprecision(5) << fabs(ans / 2.0);
}

int main() {
	read();

    return 0;
}