Pagini recente » Cod sursa (job #54809) | Cod sursa (job #2694365) | Cod sursa (job #2631530) | Cod sursa (job #368619) | Cod sursa (job #1878770)
#include <fstream>
#include <math.h>
#include <iomanip>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
int main()
{
int n;
double x1,y1,x2,y2,xp,yp;
fin>>n;
fin>>xp>>yp;
x1=xp;
y1=yp;
double arie=0;
for(int i=2;i<=n;i++)
{
fin>>x2>>y2;
arie+=(x1*y2-x2*y1)/2;
x1=x2;
y1=y2;
}
arie+=(x1*yp-xp*y1)/2;
fout<<fixed<<setprecision(6)<<fabs(arie);
return 0;
}