Pagini recente » Cod sursa (job #1500615) | Cod sursa (job #1440803) | Cod sursa (job #445259) | Cod sursa (job #1634980) | Cod sursa (job #1095129)
#include <fstream>
#include <iomanip>
#include <cmath>
#define Nmax 100099
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
int N;
struct point{long double x,y;}P[Nmax];
long double Arie(point P[Nmax])
{
long double aux=0.0;
for (int i=1; i<=N; ++i) aux+=1.0*(P[i].x*P[i+1].y-P[i+1].x*P[i].y);
aux*=0.5;
return fabs(aux);
}
void ReadInput();
int main()
{
ReadInput();
setprecision(5);
g<<Arie(P)<<'\n';
f.close();g.close();
return 0;
}
void ReadInput()
{
f>>N;
for (int i=1; i<=N; ++i) f>>P[i].x>>P[i].y;
P[0]=P[N] , P[N+1]=P[1];
}