Cod sursa(job #2288082)
| Utilizator | Data | 22 noiembrie 2018 20:42:27 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main()
{
ifstream fin ("aria.in");
ofstream fout ("aria.out");
int n;
double xinit,yinit,xant,yant,x,y;
long double arie=0;
fin>>n>>x>>y;
xinit=xant=x;
yinit=yant=y;
for (int i=2;i<=n;++i)
{
fin>>x>>y;
arie+=(long double)xant*y-(long double)x*yant;
xant=x;
yant=y;
}
arie+=(long double)xant*yinit-(long double)xinit*yant;
arie/=2;
fout<<setprecision(6)<<fixed<<arie;
return 0;
}
