Cod sursa(job #3269614)
| Utilizator | Data | 20 ianuarie 2025 00:14:54 | |
|---|---|---|---|
| Problema | Aria | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.43 kb |
#include <fstream>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
int n;
double x1, y1, x2, y2, ax1, ay1;
long double arie;
int main()
{
fin >> n >> ax1 >> ay1;
x1 = ax1, y1 = ay1;
while(--n)
{
fin >> x2 >> y2;
arie += (x1 * y2 - x2 * y1);
x1 = x2, y1 = y2;
}
arie += (x1 * ay1 - ax1 * y1);
arie /= 2;
fout << arie;
return 0;
}
