Pagini recente » Cod sursa (job #2652943) | Cod sursa (job #2629333) | Cod sursa (job #1692265) | Cod sursa (job #471999) | Cod sursa (job #2653100)
#include <fstream>
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
ifstream fin("aria.in");
ofstream fout("aria.out");
int N;
fin >> N;
float x0, y0, x1, y1;
fin >> x0 >> y0;
x1 = x0; y1 = y0;
float A = 0;
for (int i = 1; i < N; i++)
{
float x2, y2;
fin >> x2 >> y2;
A += (x1 * y2 - x2 * y1);
x1 = x2; y1 = y2;
}
A += (x1 * y0 - x0 * y1);
A /= 2;
fout << A;
return 0;
}