Cod sursa(job #2646212)

Utilizator OvidRata Ovidiu Ovid Data 31 august 2020 13:31:27
Problema Aria Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.9 kb
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll

ifstream fin("aria.in"); ofstream fout("aria.out");
#define cin fin
#define cout fout

int t, n, m, k, a[300010], q, l, r;
long double x[100010], y[100010];

int32_t main(){
INIT
cin>>n;
for(int i=1; i<=n; i++){
    cin>>x[i]>>y[i];
}
long double A=0.0;
long double x1=0.0, y1=0.0;

for(int i=2; i<=n; i++){
    //y[i]-y[i-1], x2=x[i]-x[i-1];
    A=A+(x1*y[i]-x1*y[i-1]-x[i]*y1+y1*x[i-1] )/((double)2.000000000);
    x1=x1+x[i]-x[i-1]; y1=y1+y[i]-y[i-1];
}
cout<<fixed<<setprecision(8)<<A;



return 0;
}