Pagini recente » Cod sursa (job #1110417) | Cod sursa (job #2709585) | Cod sursa (job #2455797) | Cod sursa (job #3005614) | Cod sursa (job #1921990)
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
int main(){
int n,i;
long double a,b,x1,x2,y1,y2,s;
fin >> n;
fin >> a >> b;
x1 = a;
y1 = b;
s = 0;
for (i=2;i<=n;++i) {
fin >> x2 >> y2;
s += x1 * y2 - x2 * y1;
x1 = x2;
y1 = y2;
}
s += x2*b - a*y2;
s = fabs(s / 2.0);
fout << fixed << setprecision(20) << s;
return 0;
}