Cod sursa(job #1690528)
Utilizator | Data | 15 aprilie 2016 11:15:27 | |
---|---|---|---|
Problema | Aria | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.53 kb |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int N;
long double rs;
ifstream fin("aria.in");
ofstream fout("aria.out");
struct punct{
double x, y;
};
punct A[100005];
int main(){
ios_base::sync_with_stdio(0);
fin.tie(0);
fin >> N;
for(int i = 1; i <= N; i++)
fin >> A[i].x >> A[i].y;
A[0] = A[N];
A[N+1] = A[1];
for(int i = 1; i <= N; i++)
rs += A[i].x*(A[i+1].y - A[i-1].y);
fout << setprecision(6) << fixed << abs(rs/2.0);
return 0;
}