Cod sursa(job #1541107)
Utilizator | Data | 3 decembrie 2015 19:26:47 | |
---|---|---|---|
Problema | Aria | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.43 kb |
#include <bits/stdc++.h>
using namespace std;
int main()
{
ifstream f("aria.in");
ofstream g("aria.out");
double A = 0;
int N, x1, y1, x, y, xp, yp;
f >> N >> x1 >> y1;
xp = x1; yp = y1;
for(int i = 2; i <= N; i ++) {
f >> x >> y;
A += (xp * y - yp * x);
xp = x; yp = y;
}
A += (xp * x1 - yp * y1);
g << setprecision(10) << A / 2 << "\n";
return 0;
}