Pagini recente » Cod sursa (job #2840139) | Cod sursa (job #2306900) | Cod sursa (job #1236188) | Cod sursa (job #241807) | Cod sursa (job #2049203)
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
#define lim 100010
struct point {int x,y;} ini[lim];
int n;
double rez=0;
double arie (point a, point b, point c)
{
return (double) a.x*b.y + c.x*a.y + b.x*c.y - c.x*b.y - b.x*a.y - a.x*c.y;
}
int main()
{
fin>>n;
for (int i=1; i<=n; i++)
fin>>ini[i].x>>ini[i].y;
ini[++n]=ini[1];
for (int i=1; i<=n-1; i++)
rez += ini[i].x*ini[i+1].y - ini[i].y*ini[i+1].x;
fout<<setprecision(5)<<fixed<<(double)rez/2;
fin.close();
fout.close();
return 0;
}