Pagini recente » Cod sursa (job #1910914) | Cod sursa (job #1335693) | Cod sursa (job #1451792) | Profil Sasha_12454 | Cod sursa (job #2648466)
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f ( "aria.in" );
ofstream g ( "aria.out" );
struct punct
{
int x, y;
};
int main()
{
punct pr, a, b;
double arie = 0;
int n;
f >> n;
f >> pr.x >> pr.y;
a = pr;
for ( int i = 2; i <= n; i++ )
{
f >> b.x >> b.y;
arie += ( 1LL*a.x * b.y - 1LL*a.y * b.x );
a = b;
}
arie += (1LL*pr.y * b.x - 1LL*pr.x * b.y);
g << setprecision(5)<<arie/2.0;
return 0;
}