Pagini recente » Cod sursa (job #3257034) | Cod sursa (job #3259329) | Cod sursa (job #941980) | Cod sursa (job #149492) | Cod sursa (job #1367365)
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
int n;
vector <pair<double, double>> v;
int main() {
fin >> n;
for(int i = 0 ; i < n ; ++ i) {
double x, y;
fin >> x >> y;
v.push_back(make_pair(x, y));
}
double ans = 0;
v.push_back(v[0]);
for(int i = 0 ; i < n ; ++ i)
ans = ans + v[i].first * v[i + 1].second - v[i + 1].first * v[i].second;
fout << 0.5 * ans << '\n';
}