Pagini recente » Cod sursa (job #3232139) | Cod sursa (job #164047) | Clasament prosoft2017-1112 | Profil andrici_cezar | Cod sursa (job #904080)
Cod sursa(job #904080)
#include <fstream>
#include <iomanip>
#include <cmath>
using namespace std;
const int Nmax = 100010;
ifstream F("aria.in");
ofstream G("aria.out");
typedef pair<int,int> 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';
}