Pagini recente » Cod sursa (job #2774363) | Cod sursa (job #48221) | Cod sursa (job #1354299) | Cod sursa (job #579481) | Cod sursa (job #1095141)
#include <fstream>
#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+=(P[i].x*P[i+1].y-P[i+1].x*P[i].y);
return 0.5*fabs(aux);
}
void ReadInput();
int main()
{
ReadInput();
g.precision(5);
g<<fixed<<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[N+1]=P[1];
}