Pagini recente » Cod sursa (job #2549658) | Cod sursa (job #2277345) | Cod sursa (job #2765356) | Cod sursa (job #1334970) | Cod sursa (job #2213972)
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
int i,n,atot;
double atotd;
struct hh{
int x,y;
};
hh a,b,a1;
int arie(int x1,int y1,int x2,int y2)
{
return x1*y2-y1*x2;
}
int main()
{
f>>n;
f>>a.x>>a.y;
a1=a;
for(i=2;i<=n;i++)
{
f>>b.x>>b.y;
atot+=arie(a.x,a.y,b.x,b.y);
a=b;
}
atot+=arie(b.x,b.y,a1.x,a1.y);
atotd=atot/2;
g<<setprecision(6)<<fixed<<atotd;
}