Cod sursa(job #1966220)
Utilizator | Data | 14 aprilie 2017 23:56:49 | |
---|---|---|---|
Problema | Aria | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.49 kb |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
double x1, y1, xi, yi, xj, yj;
double arie = 0;
ifstream fin ("aria.in");
ofstream fout ("aria.out");
fin >> n;
fin >> x1 >> y1;
xi = x1;
yi = y1;
for (int i = 1; i<n; ++i)
{
fin >> xj >> yj;
arie += (xi*yj-xj*yi);
xi = xj;
yi = yj;
}
arie += (xi*y1-x1*yi);
fout << setprecision(6) << fixed << arie/2.0;
return 0;
}