Pagini recente » Cod sursa (job #2135919) | Cod sursa (job #180720) | Cod sursa (job #1094691) | Cod sursa (job #3178083) | Cod sursa (job #2276733)
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main()
{
ifstream fin ("aria.in");
ofstream fout ("aria.out");
int n;
double x,y,xant,yant,xini,yini;
long double arie=0;
fin>>n>>x>>y;
xant=xini=x;
yant=yini=y;
for (int i=2; i<=n; i++)
{
fin>>x>>y;
arie+=(xant*y-x*yant);
xant=x;
yant=y;
}
arie+=(xant*yini-xini*yant);
if (arie<0)
arie=-arie;
fout<<setprecision(6)<<fixed<<arie/2;
return 0;
}