Cod sursa(job #1978462)
| Utilizator | Data | 7 mai 2017 20:00:04 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.49 kb |
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
int main()
{
long double s = 0;
double x1, x2, y1, y2;
int N;
f >> N;
f >> x1 >> y1;
double x = x1, y = y1;
for(int i = 2; i <= N; i++)
{
f >> x2 >> y2;
s += x1 * y2 - x2 * y1;
x1 = x2, y1 = y2;
}
s += x1 * y - x * y1;
g << fixed << setprecision(5) << s / 2;
return 0;
}
