Cod sursa(job #3211508)
Utilizator | TanasucaGeorgeAlexandru TanasucaGeorgeAlexandru | Data | 9 martie 2024 13:47:02 |
---|---|---|---|
Problema | Aria | Scor | 70 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.5 kb |
#include <bits/stdc++.h>
using namespace std;
struct Punct
{
double x, y;
};
Punct a[100003];
int n;
int main()
{
int i, n;
double answer;
ifstream fin("aria.in");
ofstream fout("aria.out");
fin >> n;
for (i = 0; i < n; i++)
fin >> a[i].x >> a[i].y;
a[n] = a[0];
answer = 0;
for (i = 0; i < n; ++i)
answer += (a[i].x * a[i + 1].y - a[i + 1].x * a[i].y);
fout << fixed << setprecision(5) << answer / 2;
fout.close();
}