Pagini recente » Cod sursa (job #3200411) | Cod sursa (job #483674) | Cod sursa (job #2390487) | Cod sursa (job #2913428) | Cod sursa (job #3202018)
#include <fstream>
#include <iomanip>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
int main()
{
int n;
fin>>n;
long double x1,y1;
fin>>x1>>y1;
long double x0=x1,y0=y1;
long double arie=0;
for (int i=2; i<=n; i++)
{
long double x2,y2;
fin>>x2>>y2;
arie += (x1 * y2 - x2 * y1) / 2.0;
if (i==n)
arie=arie+(x2 * y0 - x0 * y2)/2.0;
x1=x2;
y1=y2;
}
fout<<setprecision(10)<<fixed<< arie;
return 0;
}