Pagini recente » Cod sursa (job #3184618) | Cod sursa (job #2570322)
#include <fstream>
#include <iomanip>
using namespace std;
ifstream fin ("aria.in");
ofstream fout ("aria.out");
const int nmax=100005;
int main()
{
int n;
fin >> n;
long double rez=0;
pair <long double,long double> pct[nmax];
for (int i=1;i<=n;i++)
{
fin >> pct[i].first >> pct[i].second;
}
pct[n+1]=pct[1];
for (int i=1;i<=n;i++)
{
rez=rez+pct[i].first*pct[i+1].second-pct[i+1].first*pct[i].second;
}
fout << fixed << setprecision(6) << rez/2;
}