Pagini recente » Cod sursa (job #489925) | Cod sursa (job #1175578) | Cod sursa (job #2525348) | Cod sursa (job #1171775) | Cod sursa (job #1233975)
#include <cstdio>
using namespace std;
const char Input[]="aria.in";
const char Output[]="aria.out";
int n;
double t,x1,x2,y1,y2;
inline double abs(double a)
{
return ((a>=0)?a:-a);
}
int main()
{
double x3,y3;
freopen(Input,"r",stdin);
freopen(Output,"w",stdout);
scanf("%d",&n);
scanf("%lf %lf",&x1,&y1);
x3=x1;
y3=y1;
--n;
t=0;
for(;n;--n)
{
scanf("%lf %lf",&x2,&y2);
t+=x1*y2-y1*x2;
x1=x2;
y1=y2;
}
t+=x1*y3-x3*y1;
t*=0.5;
printf("%.7lf\n",abs(t));
return 0;
}