Cod sursa(job #1112690)
| Utilizator | Data | 19 februarie 2014 22:48:43 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <fstream>
#include <iomanip>
#define x first
#define y second
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
typedef pair<long double,long double> Punct;
Punct p[100002];
long double arie ;
int main()
{
int n;
fin>>n;
for(int i=1;i<=n;i++)
{
fin>>p[i].x;
fin>>p[i].y;
}
p[0] = p[n];
for(int i=0;i<n;i++)
arie += p[i].x * p[i+1].y - p[i+1].x*p[i].y;
fout<<fixed<<setprecision(7)<<arie/2;
fin.close();
fout.close();
return 0;
}
