Pagini recente » Cod sursa (job #3178425) | Cod sursa (job #3121533) | Cod sursa (job #2871641) | Cod sursa (job #2445750) | Cod sursa (job #2495027)
#include <bits/stdc++.h>
#define NMAX 100005
using namespace std;
ifstream f ("aria.in");
ofstream g ("aria.out");
int n;
struct Point
{
long double x , y;
}a[NMAX];
double Aria(Point a , Point b)
{
return (a.x * b.y - a.y * b.x) / 2;
}
int main()
{
int i;
f >> n;
for(i = 1 ; i <= n ; i++)
f >> a[i].x >> a[i].y;
long double ans = 0;
a[n + 1] = a[1];
for(i = 1 ; i <= n ; i++)
ans += Aria(a[i] , a[i + 1]);
g << setprecision(5) << fixed << ans;
return 0;
}