Cod sursa(job #1533316)
| Utilizator | Data | 22 noiembrie 2015 13:25:48 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.56 kb |
#include <fstream>
#include <cmath>
#include <iomanip>
#define x first
#define y second
using namespace std;
ifstream in("aria.in");
ofstream out("aria.out");
int n;
double sol;
pair < double, double > V[100010];
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++)
{
sol += (V[i].x * V[i + 1].y - V[i].y * V[i + 1].x);
}
out << fixed << setprecision(5) << abs(sol / 2) << '\n';
out.close();
return 0;
}
