Mai intai trebuie sa te autentifici.
Cod sursa(job #982139)
| Utilizator | Data | 8 august 2013 16:45:07 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.57 kb |
#include <fstream>
#include <iomanip>
#define NMax 100005
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
struct Point
{
double x,y;
};
Point P[NMax];
int N;
double Sol;
void Read()
{
fin>>N;
for(int i=1;i<=N;i++)
fin>>P[i].x>>P[i].y;
P[N+1]=P[1];
}
void Solve()
{
for(int i=1;i<=N;i++)
Sol+=P[i].x*P[i+1].y-P[i].y*P[i+1].x;
if (Sol<0) Sol*=-1;
Sol/=2;
}
void Print()
{
fout<<fixed<<setprecision(6)<<Sol<<'\n';
}
int main()
{
Read();
Solve();
Print();
return 0;
}
