Cod sursa(job #1909397)
Utilizator | Data | 7 martie 2017 12:35:53 | |
---|---|---|---|
Problema | Aria | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.54 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
const int nMax = 100005;
struct el
{
double x, y;
};
el a[nMax];
int n;
double ans;
inline void Read()
{
int i;
fin >> n;
for(i = 0; i < n; i++)
fin >> a[i].x >> a[i].y;
}
inline void Solve()
{
int i;
a[n] = a[0];
for(i = 0; i < n; i++)
ans += (a[i].x * a[i + 1].y - a[i + 1].x * a[i].y);
fout << ans / 2.0;
}
int main()
{
Read();
Solve();
return 0;
}