Cod sursa(job #1357555)
| Utilizator | Data | 23 februarie 2015 23:12:17 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.45 kb |
#include <cstdio>
#define nmax 100002
using namespace std;
FILE *f1=fopen("aria.in","r"),*f2=fopen("aria.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]=v[1];
for(i=1;i<=n;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;
}
