Pagini recente » Cod sursa (job #1345701) | Cod sursa (job #1361926) | Cod sursa (job #2759024) | Cod sursa (job #1939679) | Cod sursa (job #1647119)
#include <fstream>
#include <iomanip>
using namespace std;
ifstream in("aria.in");
ofstream out("aria.out");
int n;
double x, y, x1, y1;
int main()
{
in >> n;
in >> x >> y;
x1 = x;
y1 = y;
double xcurent, ycurent;
double arie = 0;
n--;
while(n--)
{
in >> xcurent >> ycurent;
arie += (double)(x * ycurent - y * xcurent);
x = xcurent;
y = ycurent;
}
arie += (double)(x * y1 - x1 * y);
if(arie < 0)
arie = -arie;
out << fixed << setprecision(5) << arie / 2;
return 0;
}