Pagini recente » Cod sursa (job #2437575) | Cod sursa (job #1501898) | Cod sursa (job #2072406) | Cod sursa (job #158643) | 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;
}