Pagini recente » Cod sursa (job #1843497) | Cod sursa (job #3293541) | Cod sursa (job #256644) | Cod sursa (job #389249) | Cod sursa (job #904081)
Cod sursa(job #904081)
#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';
}