Cod sursa(job #1861735)
| Utilizator | Data | 29 ianuarie 2017 11:23:46 | |
|---|---|---|---|
| Problema | Aria | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.49 kb |
#include <fstream>
#include <cmath>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
struct loc
{
double x, y;
} v[100001];
double sum;
int n;
int main()
{
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;
for(int i = 1; i <= n; ++i)
{
sum+=v[i].x*v[i+1].y-v[i+1].x*v[i].y;
}
fout<<abs(sum)/2.0;
return 0;
}
