Cod sursa(job #2227710)
| Utilizator | Data | 1 august 2018 16:22:00 | |
|---|---|---|---|
| Problema | Aria | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.55 kb |
#include <fstream>
#include <iomanip>
const int nmax=100001;
using namespace std;
int main()
{
ifstream fin("aria.in");
ofstream fout("aria.out");
int n,i;
double x0,y0,x1,y1,x2,y2;
fin>>n;
fin>>x0>>y0;
x2=x0;
y2=y0;
double s=0;
for(i=1;i<n;i++) {
x1=x2;
y1=y2;
fin>>x2>>y2;
s+=x2*y1-x1*y2;
}
s+=x0*y2-x2*y0;
if(s<0)
s=-s;
s/=2;
fout<<setprecision(10)<<s<<fixed;
fin.close();
fout.close();
return 0;
}
