Pagini recente » Cod sursa (job #2080498) | Cod sursa (job #1894503) | Cod sursa (job #2682851) | Cod sursa (job #1837945) | Cod sursa (job #2214010)
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
int i,n;
double atot;
struct hh{
double x,y;
};
hh a,b,a1;
double arie(double x1,double y1,double x2,double 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);
atot=atot/2;
g<<setprecision(5)<<fixed<<atot;
}