Pagini recente » Cod sursa (job #3127566) | Cod sursa (job #1800713) | Cod sursa (job #2768302) | Cod sursa (job #397953) | 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;
}