Cod sursa(job #3250334)
| Utilizator | Data | 20 octombrie 2024 11:37:57 | |
|---|---|---|---|
| Problema | Aria | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.59 kb |
#include <fstream>
using namespace std;
ifstream in("aria.in");
ofstream out("aria.out");
double n, i, j, ar;
struct dur
{
double x, y;
}a, b, c, that;
double abs(double x)
{
if (x > 0)
return x;
return -x;
}
int main()
{
in >> n;
in >> b.x >> b.y; that = b;
for (i = 2; i <= n; i++)
{
in >> c.x >> c.y;
ar += (a.x * b.y + a.y * c.x + b.x * c.y - a.x * c.y - a.y * b.x - b.y * c.x);
b = c;
}
c = that;
ar += (a.x * b.y + a.y * c.x + b.x * c.y - a.x * c.y - a.y * b.x - b.y * c.x);
out << ar/2;
}
