Pagini recente » Cod sursa (job #2068128) | Cod sursa (job #1787566) | Cod sursa (job #432549) | Cod sursa (job #2230549) | Cod sursa (job #2438546)
#include <iostream>
#include <fstream>
#include <math.h>
#include<iomanip>
using namespace std;
int main(){
ifstream fin("aria.in");
ofstream fout("aria.out");
int n, x, y, A = 0 , vx[1000000], vy[1000000];
fin >> n;
for(int i = 0; i < n; i++){
fin >> x >> y;
vx[i] = x;
vy[i] = y;
}
vx[n] = vx[0];
vy[n] = vy[0];
for(int j = 0; j < n; j++){
A += ((vx[j]*vy[j+1])-(vx[j+1]*vy[j]))/2;
}
fout << fixed << setprecision (7)<<A'\n';
return 0;
}