Cod sursa(job #2777833)
| Utilizator | Data | 25 septembrie 2021 10:57:52 | |
|---|---|---|---|
| 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 v[100005];
double s;
int n;
int main()
{
freopen ("aria.in", "r", stdin);
freopen ("aria.out", "w", stdout);
scanf ("%d", &n);
for(int i=1; i<=n; i++)
{
scanf ("%lf %lf", &v[i].x, &v[i].y);
}
v[n+1]=v[1];
for(int i=1; i<=n; i++)
{
s+=(v[i].x*v[i+1].y-v[i+1].x*v[i].y);
}
cout<<setprecision(6)<<fixed<<fabs(s/2.0)<<'\n';
return 0;
}
