Cod sursa(job #2634396)
| Utilizator | Data | 10 iulie 2020 19:27:36 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.49 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
typedef long double ld;
typedef pair<ld, ld> pd;
const int NMAX=1e5;
int N;
pair<ld,ld> P[NMAX+2];
int main() {
ld A=0.0;
fin>>N;
for(int i=1;i<=N;++i) {
fin>>P[i].first>>P[i].second;
}
P[N+1]=P[1];
for(int i=1;i<=N;++i) {
A+=P[i].first*P[i+1].second-P[i].second*P[i+1].first;
}
A/=2.0;
if(A<0)
A=-A;
fout<<fixed<<setprecision(6)<<A<<'\n';
return 0;
}