Mai intai trebuie sa te autentifici.
Cod sursa(job #1997645)
| Utilizator | Data | 4 iulie 2017 23:30:37 | |
|---|---|---|---|
| Problema | Aria | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.65 kb |
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream in("aria.in");
ofstream out("aria.out");
struct Point {
double x, y;
};
int n;
long long s;
Point v[100005];
long long get_signed_area(Point a, Point b) {
return (long long)a.x * b.y - (long long)b.x * a.y;
}
int main()
{
in >> n;
for (int i = 1, x, y; i <= n; ++i) {
in >> x >> y;
v[i] = {x, y};
}
v[n + 1] = v[1];
for (int i = 1; i <= n; ++i) {
s += get_signed_area(v[i], v[i + 1]);
}
double arie = (double)s / 2;
out << setprecision(5) << arie;
return 0;
}
