Cod sursa(job #1112218)
| Utilizator | Data | 19 februarie 2014 16:14:33 | |
|---|---|---|---|
| Problema | Aria | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include<fstream>
#include<iomanip>
#include<cmath>
using namespace std;
int n;
double sol;
ifstream fin("aria.in");
ofstream fout("aria.out");
pair<double,double>curr,p,f;
int main()
{
fin>>n;
fin>>f.first>>f.second;
p=f;
for(int i=2;i<=n;i++)
{
fin>>curr.first>>curr.second;
sol+=p.first*curr.second-p.second*curr.first;
p=curr;
}
sol+=p.first*f.second-p.second*f.first;
fout<<setprecision(5)<<fixed<<fabs(sol)/2.0;
return 0;
}
