Pagini recente » Cod sursa (job #456090) | Cod sursa (job #205388) | Cod sursa (job #1319995) | Cod sursa (job #2887073) | Cod sursa (job #2499257)
#include <bits/stdc++.h>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
const int N = 100001;
int n;
long double a,x,y;
complex<long double > z[N];
int main()
{
f>>n;
for(int i=1;i<=n;i++)
{
f>>x>>y;
z[i]=complex<long double>(x,y);
}
z[0]=z[n];
for(int i=0;i<n;i++)
a+=imag(z[i]*conj(z[i+1]));
if(a<0)
a=-a;
g<<fixed<<setprecision(10)<<a/2.0;
return 0;
}