Cod sursa(job #1647061)
| Utilizator | Data | 10 martie 2016 18:51:30 | |
|---|---|---|---|
| Problema | Aria | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.59 kb |
#include <fstream>
#include <iomanip>
using namespace std;
ifstream in("aria.in");
ofstream out("aria.out");
int n;
double x, y, x1, y1;
int main()
{
in >> n;
in >> x >> y;
x1 = x;
y1 = y;
double xcurent, ycurent;
double arie = 0;
n--;
while(n--)
{
in >> xcurent >> ycurent;
arie += (double)(xcurent - x)*(ycurent + y);
x = xcurent;
y = ycurent;
}
arie += (double)(x1 - x)*(y1 + y);
if(arie < 0)
arie = -arie;
out << fixed << setprecision(6) << arie / 2;
return 0;
}
