Pagini recente » Cod sursa (job #1367945) | Cod sursa (job #1537538)
#include <fstream>
#include <algorithm>
#include <iomanip>
using namespace std;
ifstream in ("aria.in");
ofstream out ("aria.out");
int n; long long s;
pair <int, int> a[1000001];
int main()
{
in >> n;
for (int i = 1; i <= n; i++)
in >> a[i].first >> a[i].second;
a[n+1].first = a[1].first; a[n+1].second = a[1].second;
for (int i = 1; i <= n; i++)
s = s + a[i].first * a[i+1].second - a[i+1].first * a[i].second;
out << fixed << setprecision(5) << abs(s/2) << '\n';
out.close(); return 0;
}