Cod sursa(job #1367365)
| Utilizator | Data | 1 martie 2015 20:16:07 | |
|---|---|---|---|
| Problema | Aria | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#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';
}
