Pagini recente » Cod sursa (job #1643786) | Cod sursa (job #3179688) | Cod sursa (job #2850274) | Cod sursa (job #1327683) | Cod sursa (job #2241265)
#include <iostream>
#include<fstream>
#include <math.h>
#include<iomanip>
using namespace std;
ifstream fin ("aria.in");
ofstream fout ("aria.out");
int main()
{
int n;
long double x1, y1, x2, y2, x, y, ans = 0;
fin >> n >> x1 >> y1;
x2 = x1 ;
y2 = y1;
for (int i = 1 ; i <= n; ++i){
fin >> x >> y;
ans += (x1*y - x*y1);
x1 = x;
y1 = y;
}
ans +=(x1*y2 - x2*y1);
ans = ans /2.0;
fout << fixed << setprecision(6) << fabs(ans);
return 0;
}