Cod sursa(job #1609189)
Utilizator | Data | 22 februarie 2016 17:34:03 | |
---|---|---|---|
Problema | Aria | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.55 kb |
#include <bits/stdc++.h>
using namespace std;
const int L = 1e5 + 5;
ifstream f("aria.in");
ofstream g("aria.out");
struct C{
int x,y;
};
C p[L];
int main()
{
long double s=0, n;
f>>n;
for(int i = 1; i<= n; i++)
f>>p[i].x>>p[i].y;
for(int i = 1; i<= n; i++){
if(i == n)
{
p[i+1].x = p[1].x;
p[i+1].y = p[1].y;
}
s+= p[i].x*p[i+1].y-p[i+1].x*p[i].y;
}
g<<fixed<<setprecision(6)<<(long double)s/(long double)2;
return 0;
}