Pagini recente » Cod sursa (job #2166705) | Cod sursa (job #1865372) | Cod sursa (job #2582729) | Cod sursa (job #2641752) | Cod sursa (job #1252108)
#include <cstdio>
#define nmax 10001
using namespace std;
FILE *f1=fopen("arie.in","r"),*f2=fopen("arie.out","w");
int n,i;
double A;
struct point
{
double x,y;
}v[nmax];
int main()
{
fscanf(f1,"%d",&n);
for(i=1;i<=n;i++)
fscanf(f1,"%lf%lf",&v[i].x,&v[i].y);
v[n+1].x=v[1].x;v[n+1].y=v[1].y;
for(i=0;i<=n+1;i++)
A+=(v[i].x*v[i+1].y-v[i+1].x*v[i].y);
fprintf(f2,"%lf",A/2.0);
fclose(f1);
fclose(f2);
return 0;
}