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