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