Pagini recente » Cod sursa (job #2672728) | Cod sursa (job #282728) | Cod sursa (job #1226413) | Cod sursa (job #2210831) | Cod sursa (job #1153738)
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
long double aria;
struct {long double x,y;} p,last_p,first_p;
int n;
int main()
{
f>>n;
f>>last_p.x>>last_p.y;
first_p=last_p;
for(--n;n;--n)
{
f>>p.x>>p.y;
aria+=last_p.x*p.y-p.x*last_p.y;
last_p=p;
}
p=first_p;
aria+=last_p.x*p.y-p.x*last_p.y;
g<<fixed<<setprecision(5)<<aria/2;
return 0;
}