Cod sursa(job #1043977)
| Utilizator | Data | 29 noiembrie 2013 09:10:57 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin;
ofstream fout;
long double n, A=0, x1, y1, x2, y2, xi, yi;
int main()
{
fin.open("aria.in");fout.open("aria.out");
fin>>n>>x1>>y1;
xi=x1, yi=y1;
for(int i=1;i<n;i++)
{
fin>>x2>>y2;
A+=x1*y2-x2*y1;
x1=x2;y1=y2;
}
A+=x1*yi-xi*y1;
fout.precision(50);
fout<<A/2;
fout.close(); fin.close();
return 0;
}
