Cod sursa(job #1997666)
| Utilizator | Data | 4 iulie 2017 23:46:02 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
using namespace std;
ifstream in("aria.in");
ofstream out("aria.out");
struct Point {
double x, y;
};
int n;
double s;
Point v[100005];
int main()
{
in >> n;
for (int i = 1; i <= n; ++i) {
in >> v[i].x >> v[i].y;
}
v[n + 1] = v[1];
for (int i = 1; i <= n; ++i) {
s += (v[i].x * v[i + 1].y - v[i + 1].x * v[i].y);
}
out << fixed << setprecision(5) << fabs(s / 2.0);
return 0;
}
