Cod sursa(job #1523807)
Utilizator | Data | 13 noiembrie 2015 12:36:34 | |
---|---|---|---|
Problema | Aria | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.43 kb |
#include<cstdio>
using namespace std;
int n,i;
double s,x2,y2,x1,y1,x,y,d;
int main()
{
freopen("aria.in","r",stdin);
freopen("aria.out","w",stdout);
scanf("%d",&n);
scanf("%lf %lf",&x1,&y1);
x2=x1;
y2=y1;
for(i=2;i<=n;++i)
{
scanf("%lf %lf",&x,&y);
s+=x1*y-x*y1;
x1=x;
y1=y;
}
s+=x1*y2-x2*y1;
s=s/2.0;
printf("%lf",s);
return 0;
}