Cod sursa(job #2735918)
| Utilizator | Data | 2 aprilie 2021 23:08:21 | |
|---|---|---|---|
| Problema | Aria | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
double a, apart, OA, p, OB, AB;
int n, i, x1, ya1, x2, ya2;
double dist(double x1, double y1, double x2, double y2)
{
return sqrt(pow((x1-x2), 2)+pow((y1-y2), 2));
}
int main()
{
fin >> n >> x1 >> ya1;
int x0 = x1, y0 = ya1;
for (i = 2; i <= n; i++)
{
fin >> x2 >> ya2;
a += (x1*ya2-x2*ya1);
x1 = x2; ya1 = ya2;
}
a += (x1*y0-x0*ya1);
fout << a/2.0;
return 0;
}
