Cod sursa(job #1609128)
| Utilizator | Data | 22 februarie 2016 17:06:02 | |
|---|---|---|---|
| Problema | Aria | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.52 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
const int L = 1e5 + 5;
struct C
{
int x, y;
};
C p[L];
int main()
{
int n, s = 0;
f >> n;
for(int i = 1; i <= n; i++)
f >> p[i].x >> p[i].y;
for(int i = 1; i <= n; i++)
{
if(i == n)
{
p[i + 1].x = p[1].x;
p[i + 1].y = p[1].y;
}
s += p[i].x * p[i + 1].y - p[i + 1].x * p[i].y;
}
g << abs(s / 2);
return 0;
}
