Cod sursa(job #1233972)
Utilizator | Data | 26 septembrie 2014 15:18:03 | |
---|---|---|---|
Problema | Aria | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.59 kb |
#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;
printf("%.5lf\n",abs(t)*0.5);
return 0;
}