Cod sursa(job #2907477)
| Utilizator | Data | 30 mai 2022 14:32:24 | |
|---|---|---|---|
| Problema | Aria | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <fstream>
#include <algorithm>
#include <iomanip>
using namespace std;
struct pct
{
double x, y;
};
int main()
{
ifstream cin("aria.in");
ofstream cout("aria.out");
int n, i;
pct last, ceva;
cin >> n >> last.x >> last.y;
ceva = last;
double ans = 0;
for (i = 1; i < n; i++)
{
double a, b;
cin >> a >> b;
ans += b * last.x - a * last.y ;
last = {a, b};
}
ans += ceva.y * last.x - ceva.x * last.y;
ans /= 2;
cout << ans;
}
