Cod sursa(job #3256677)
| Utilizator | Data | 15 noiembrie 2024 18:16:28 | |
|---|---|---|---|
| Problema | Aria | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.56 kb |
#include <fstream>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
ifstream fin("aria.in");
ofstream fout("aria.out");
int n;
fin >> n;
long double a = 0.0, x1, y1, x2, y2, x_start, y_start;
fin >> x_start >> y_start;
y1 = y_start;
for (int i = 1; i < n; i++) {
fin >> x2 >> y2;
a += (x1 * y2) - (x2 * y1);
x1 = x2;
y1 = y2;
}
a += (x1 * y_start) - (x_start * y1);
fout << fixed << setprecision(5) << abs(a / 2.0) << endl;
return 0;
}
