Pagini recente » Monitorul de evaluare | Cod sursa (job #2363844) | Cod sursa (job #2362389) | Istoria paginii grigore-moisil-2008/solutii/joc8 | Cod sursa (job #1762637)
#include <fstream>
#include <iomanip>
int main()
{
std::ifstream input("aria.in");
std::ofstream output("aria.out");
int n;
long double aria = 0;
input >> n;
long double first_x, first_y, prev_x, prev_y, x, y;
input >> x >> y;
first_x = x;
first_y = y;
for(int i = 1; i < n; ++i) {
prev_x = x;
prev_y = y;
input >> x >> y;
aria += prev_x * y - prev_y * x;
}
aria += x * first_y - y * first_x;
aria /= 2;
if(aria < 0) aria = -aria;
output << std::fixed << std::setprecision(6) << aria << '\n';
return 0;
}