Cod sursa(job #1609186)
Utilizator | Data | 22 februarie 2016 17:32:01 | |
---|---|---|---|
Problema | Aria | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.58 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
const int L = 1e5 + 5;
struct C
{
long double x, y;
};
C p[L];
int main()
{
long double n, s = 0;
f >> n;
for(int i = 1; i <= n; i++)
f >> p[i].x >> p[i].y;
for(int i = 1; i <= n; i++)
{
if(i == n)
{
p[i + 1].x = p[1].x;
p[i + 1].y = p[1].y;
}
s += p[i].x * p[i + 1].y - p[i + 1].x * p[i].y;
}
g << fixed << setprecision(6) << (long double)s / (long double)2;
return 0;
}