Cod sursa(job #1796189)

Utilizator andreey_047Andrei Maxim andreey_047 Data 3 noiembrie 2016 10:40:51
Problema Aria Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.74 kb
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

const int nmax = 100005; const LL inf = 1e18;

struct el{
 double x,y;
}a[nmax];
int N;
double sol;

inline long double Arie(int i,int j,int q){
 return ((a[j].x-a[i].x)*(a[q].y-a[i].y) - (a[j].y-a[i].y)*(a[q].x-a[i].x));
}
int main(){
//   #ifndef GLOBAL_JUDGE
//      freopen("txt.in","r",stdin);
//      freopen("txt.out","w",stdout);
//   #endif // GLOBAL_JUDGE
   ifstream f("Aria.in");
   ofstream g("Aria.out");
   int i;
   f >> N;
   for(i = 1; i <= N; ++i)
      f>> a[i].x >> a[i].y;
   for(i = 3; i <= N; ++i)
      sol+=Arie(1,i-1,i);
   sol/=2;
   g << fixed << setprecision(6)<< sol << '\n';
   f.close();
   g.close();
   return 0;
}