Pagini recente » Cod sursa (job #1210426) | Cod sursa (job #2316123) | Cod sursa (job #408244) | Cod sursa (job #2756741) | Cod sursa (job #1653997)
#include <fstream>
#include <math.h>
#include <iomanip>
#define nMax 100005
#define x first
#define y second
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
pair<double, double> v[nMax];
double sol;
int n;
int main()
{
fin>>n;
for(int i=0;i<n;i++)
fin>>v[i].x>>v[i].y;
v[n]=v[0];
for(int i=0;i<n;i++)
sol+=(v[i].x*v[i+1].y - v[i+1].x*v[i].y);
fout<<fixed<<setprecision(6)<<fabs(sol/2.0);
return 0;
}