Cod sursa(job #1978459)
| Utilizator | Data | 7 mai 2017 19:43:51 | |
|---|---|---|---|
| Problema | Aria | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
int main()
{
int N;
double x0,x1,x2,y0,y1,y2,s=0;
f >> N;
f >> x0 >> y0;
x1=x0;
y1=y0;
s = 0;
for (int i=2; i<=N; i++)
{
f >> x2 >> y2;
s += x1 * y2 - x2 * y1;
x1 = x2;
y1 = y2;
}
s += x2*y0 - x0*y2;
s /= 2;
g << setprecision(5) << s;
return 0;
}
