Cod sursa(job #2495978)
Utilizator | Verestiuc Andrei VerestiucAndrei | Data | 20 noiembrie 2019 08:30:36 |
---|---|---|---|
Problema | Aria | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.5 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("aria.in");
ofstream fout ("aria.out");
int n,i,j;
struct hatz
{
long double x,y;
};
hatz p[100005];
long double x;
int main()
{
fin>>n;
x=0;
for (i=1; i<=n; i++)
{
fin>>p[i].x>>p[i].y;
}
p[n+1].x=p[1].x;
p[n+1].y=p[1].y;
for (i=1; i<=n; i++)
{
x=x+(p[i].x*p[i+1].y-p[i+1].x*p[i].y);
}
fout<<fixed<<setprecision(9)<<x/2;
fout.close();
return 0;
}