Cod sursa(job #1404692)
| Utilizator | Data | 28 martie 2015 14:20:25 | |
|---|---|---|---|
| Problema | Aria | Scor | 80 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <algorithm>
using namespace std;
int n;
long double x, y, xprim, yprim, newX, newY, S;
int main()
{
freopen("aria.in", "r", stdin);
freopen("aria.out", "w", stdout);
cin>>n;
cin>>x>>y;
xprim = x;
yprim = y;
for (int i = 2; i <= n; ++i){
cin>>newX>>newY;
S = S + x * newY - newX * y;
x = newX;
y = newY;
}
S = S + newX * yprim - xprim * newY;
cout<<setprecision(5)<<fixed<<S/2<<"\n";
return 0;
}
