Pagini recente » Cod sursa (job #3148989) | Cod sursa (job #2815516) | Cod sursa (job #1061235) | Cod sursa (job #2192878) | Cod sursa (job #1921911)
#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;
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 - x2) * (y1 + y2);
x1 = x2;
y1 = y2;
}
s += (x2 - a) * (y2 + b);
s = fabs(s / 2.0);
fout << fixed << setprecision(5) << s;
return 0;
}