Mai intai trebuie sa te autentifici.
Cod sursa(job #1537556)
Utilizator | Data | 27 noiembrie 2015 15:39:26 | |
---|---|---|---|
Problema | Aria | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.48 kb |
#include <iostream>
#include <fstream>
#include <cmath>
#include <iomanip>
#define maxN 100005
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
struct interval {float x,y;} v[maxN];
int n;
double S;
int main()
{
fin>>n;
for (int i=1; i<=n; ++i)
fin>>v[i].x>>v[i].y;
v[n+1]=v[1];
for (int i=1; i<=n; ++i)
S+=(v[i].x*v[i+1].y-v[i+1].x*v[i].y);
fout<<fixed<<setprecision(5)<<fabs(S/2);
return 0;
}