Cod sursa(job #1095768)
| Utilizator | Data | 31 ianuarie 2014 20:37:11 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.58 kb |
#include <cstdio>
using namespace std;
#define NMAX 100005
struct Point
{
double x,y;
};
Point V[NMAX];
int N;
double A;
void Read()
{
freopen("aria.in","r",stdin);
scanf("%d",&N);
for(int i=1;i<=N;i++)
scanf("%lf%lf",&V[i].x,&V[i].y);
V[N+1] = V[1];
}
void Solve()
{
for(int i=1;i<N+1;i++)
A += V[i].x * V[i+1].y - V[i+1].x * V[i].y;
A /= 2;
}
void Print()
{
freopen("aria.out","w",stdout);
printf("%.6lf",A);
}
int main()
{
Read();
Solve();
Print();
return 0;
}
