You are on page 1of 2

#include <iostream>

#include <fstream>
#include <iomanip>

using namespace std;

ifstream fin("aria.in");
ofstream fout("aria.out");

const int NMAX = 100000 + 5;

struct point
{
double x;
double y;

point()
{
x = 0;
y = 0;
}

point(double _x, double _y)


{
x = _x;
y = _y;
}
};

point v[NMAX];
int n;
double area;

double get_area()
{
double sum = 0;
for (int i = 1; i <= n; ++i)
sum += v[i].x * v[i + 1].y - v[i + 1].x * v[i].y;
return sum / 2.0;
}

void write()
{
fout << setprecision(5) << fixed << area;
}

void read()
{
double x, y;

fin >> n;
for (int i = 1; i <= n; ++i)
{
fin >> x >> y;
v[i] = point(x, y);
}
v[n + 1] = v[1];
}
int main()
{
read();
area = get_area();
write();

return 0;
}

You might also like