Cod sursa(job #1418413)
| Utilizator | Data | 13 aprilie 2015 00:31:26 | |
|---|---|---|---|
| Problema | Aria | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.58 kb |
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
const int NMax = 100005;
struct node{
long long int x,y;
}v[NMax];
int main()
{
int n;
fin >> n;
for(int i = 1; i <= n; i++){
fin >> v[i].x >> v[i].y;
}
v[n + 1].x = v[1].x;
v[n + 1].y = v[1].y;
long double ans = 0;
for(int i = 1; i <= n; i++){
ans = ans + v[i].x * v[i + 1].y - v[i].y * v[i + 1].x;
}
ans /= 2;
fout << fixed << setprecision(5) << ans;
return 0;
}
