Cod sursa(job #904081)
Utilizator | Dan H Alexandru danalex97 | Data | 3 martie 2013 18:34:30 |
---|---|---|---|
Problema | Aria | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.53 kb |
#include <fstream>
#include <iomanip>
#include <cmath>
using namespace std;
const int Nmax = 100010;
ifstream F("aria.in");
ofstream G("aria.out");
typedef pair<double,double> Pair;
#define x first
#define y second
int N;
Pair P[Nmax];
double Out;
int main ()
{
F>>N;
for (int i=1;i<=N;++i)
F>>P[i].x>>P[i].y;
P[++N]=P[1];
for (int i=1;i<N;++i)
Out += (1LL*P[i].x*P[i+1].y) - (1LL*P[i+1].x*P[i].y);
Out = fabs(Out) / 2.0;
G<<fixed<<setprecision(4)<<Out<<'\n';
}