Pagini recente » Cod sursa (job #2935294) | Cod sursa (job #2407339) | Cod sursa (job #2928616) | Cod sursa (job #754950) | Cod sursa (job #1796194)
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int nmax = 100005; const LL inf = 1e18;
ifstream f("aria.in");
ofstream g("aria.out");
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
int i;
f >> N;
for(i = 1; i <= N; ++i)
f>> a[i].x >> a[i].y;
f.close();
for(i = 3; i <= N; ++i)
sol+=Arie(1,i-1,i);
sol/=2;
g << fixed << setprecision(6)<< sol << '\n';
g.close();
return 0;
}