Cod sursa(job #1201641)
| Utilizator | Data | 25 iunie 2014 16:41:32 | |
|---|---|---|---|
| Problema | Aria | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
using namespace std;
#include <fstream>
ifstream fin("aria.in");
ofstream fout("aria.out");
const int vfMax = 100000;
struct _punct {int x, y;};
struct _poligon
{
int vf;
_punct v[vfMax + 2];
};
_poligon p;
int main()
{
int i, s;
fin >> p.vf;
for(i = 1; i <= p.vf; ++i) fin >> p.v[i].x >> p.v[i].y;
p.v[0] = p.v[p.vf]; p.v[p.vf + 1] = p.v[1];
for(s = 0, i = 1; i <= p.vf; ++i)
s += p.v[i].x * (p.v[i-1].y - p.v[i+1].y);
if(s < 0) s = -s;
fout << (s >> 1) << '\n';
return 0;
}
