Pagini recente » Cod sursa (job #566361) | Cod sursa (job #391742) | Cod sursa (job #1961265) | Cod sursa (job #79815) | Cod sursa (job #2572523)
#include <bits/stdc++.h>
#define MAX 100100
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
struct poz{
long double x,y;};
poz v[MAX];
long double aria;
long double determ(poz a,poz b)
{
return (a.x*b.y)-(b.x*a.y);
}
int n;
int main()
{
int i;
fin>>n;
for(i=1;i<=n;i++)
{
fin>>v[i].x>>v[i].y;
}
v[n+1]=v[1];
for(i=1;i<=n;i++)
aria+=determ(v[i],v[i+1]);
aria/=2;
fout<<setprecision(6)<<fixed;
fout<<aria;
return 0;
}