Pagini recente » Cod sursa (job #2161023) | Cod sursa (job #2639473) | Cod sursa (job #2885900) | Cod sursa (job #600580) | Cod sursa (job #2547498)
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
ifstream in("aria.in");
ofstream out("aria.out");
int n;
long double a,b;
pair<long double,long double> v,v2;
long double dp;
long double rez;
int main()
{
in>>n;
in>>a>>b;
v2.first=a;
v2.second=b;
for(int i=2;i<=n;i++)
{
in>>v.first>>v.second;
dp=(v2.first*v.second-v.first*v2.second);
rez+=dp;
v2.first=v.first;
v2.second=v.second;
}
dp=(v2.first*b-a*v2.second);
rez+=dp;
out<<fixed<<setprecision(5)<<rez/2;
return 0;
}