Pagini recente » Cod sursa (job #2105804) | Cod sursa (job #2590552) | Cod sursa (job #1820068) | Cod sursa (job #2083246) | Cod sursa (job #2438544)
#include <iostream>
#include <fstream>
#include <math.h>
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 << A <<'\n';
return 0;
}