Cod sursa(job #2170730)
Utilizator | Data | 15 martie 2018 09:34:27 | |
---|---|---|---|
Problema | Aria | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.42 kb |
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f ("aria.in");
ofstream g ("aria.out");
int n;
double s;
struct
{
double x,y;
}v[100003];
int main()
{
f>>n;
for(int i=1;i<=n;++i) f>>v[i].x>>v[i].y;
v[n+1]=v[1];
for(int i=1;i<=n;++i) s=s+v[i].x*v[i+1].y-v[i+1].x*v[i].y;
if(s<0) s=-s;
s/=2.0;
g<<fixed<<setprecision(6)<<s;
return 0;
}