Cod sursa(job #2304298)
| Utilizator | Data | 17 decembrie 2018 21:14:06 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
pair<long double, long double> pct[100005];
int n;
int main()
{
fin >> n;
long double arie = 0.00000;
for(int i = 1; i <= n; ++i)
fin >> pct[i].x >> pct[i].y;
pct[n + 1] = pct[1];
for(int i = 1; i <= n; ++i)
arie += pct[i].x * pct[i + 1].y - pct[i + 1].x * pct[i].y;
arie /= 2;
fout << fixed << setprecision(6) << arie;
return 0;
}
