Cod sursa(job #1966708)
Utilizator | Data | 15 aprilie 2017 15:15:31 | |
---|---|---|---|
Problema | Aria | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.45 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
int main()
{
int N;
double x1, y1, x2, y2, x3, y3;
long double A = 0;
f >> N >> x1 >> y1;
x2 = x1;
y2 = y1;
while(--N)
{
f >> x3 >> y3;
A += x2 * y3 - x3 * y2;
x2 = x3;
y2 = y3;
}
A += x2 * y1 - x1 * y2;
A /= 2;
g << setprecision(5) << fixed << A;
return 0;
}