Pagini recente » Cod sursa (job #2309833) | Cod sursa (job #1591049) | Cod sursa (job #2430265) | Cod sursa (job #2819832) | Cod sursa (job #2333957)
#include <fstream>
#include <iomanip>
int main(int argc, const char * argv[]) {
std::ifstream fin("aria.in");
int n;
fin >> n;
long double result = 0;
long double x1, y1;
fin >> x1 >> y1;
long double x = x1, y = y1;
for (int i = 0; i < n; i++) {
long double x2, y2;
fin >> x2 >> y2;
result += (x1*y2 - x2*y1) / 2;
x1 = x2;
y1 = y2;
}
result += (x1*y - x*y1) / 2;
std::ofstream fout("aria.out");
fout << std::setprecision(5) << std::fixed << result;
}