Pagini recente » Cod sursa (job #1049997) | Cod sursa (job #171628) | Cod sursa (job #1293842) | Cod sursa (job #820314) | Cod sursa (job #2829239)
#include <fstream>
#include <cmath>
#include <iomanip>
int main() {
std::ifstream fin("aria.in");
std::ofstream fout("aria.out");
int nrn;
double posx, posy, antx, anty, fstx, fsty;
double ans = 0;
fin >> nrn;
fin >> antx >> anty;
fstx = antx;
fsty = anty;
for (int index = 1; index < nrn; index++) {
fin >> posx >> posy;
ans += (posy * antx - posx * anty) / 2;
antx = posx;
anty = posy;
}
ans += (fsty * antx - fstx * anty) / 2;
fout << std::fixed << std::setprecision(5) << ans;
}