Pagini recente » Cod sursa (job #59356) | Cod sursa (job #210381) | Cod sursa (job #9356) | Cod sursa (job #1893332) | Cod sursa (job #1095124)
#include <fstream>
#include <iomanip>
#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 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];
}