Pagini recente » Cod sursa (job #2554954) | Cod sursa (job #2618560) | Cod sursa (job #2606868) | Cod sursa (job #3030410) | Cod sursa (job #2564204)
#include <bits/stdc++.h>
using namespace std;
#define zero(x) (x & (-x))
#define ll long long
ifstream fin("aria.in");
ofstream fout("aria.out");
const int MAXN = 1e5 + 3;
const double EPS = 1e-8;
const long double INF = 1e12;
struct punct{
long double x, y;
}v[MAXN];
long double arie_triunghi(punct a, punct b, punct c){
return a.x * b.y + b.x * c.y + c.x * a.y - c.x * b.y - a.y * b.x - c.y * a.x;
}
int main(){
int n; fin >> n;
long double s = 0;
for(int i = 1; i <= n; ++i)
fin >> v[i].x >> v[i].y;
v[n + 1] = v[1];
for(int i = 1; i <= n; ++i)
s += arie_triunghi({0, 0}, v[i], v[i + 1]);
s = abs(s);
fout << setprecision(5) << fixed << 0.5 * s;
return 0;
}
///18.681542