Pagini recente » Cod sursa (job #2119114) | Cod sursa (job #738633) | Cod sursa (job #1018106) | Cod sursa (job #1754823) | Cod sursa (job #2302562)
#include <fstream>
#include <iomanip>
using namespace std;
ifstream fin ("aria.in");
ofstream fout ("aria.out");
int n;
struct punct {
double x,y;}v[100005],x;
int crossproduct (punct a, punct o, punct b)
{
int d;
d= (a.x-o.x)*(b.y-o.y)-(b.x-o.x)* (a.y-o.y);
return d;
}
int A;
int main()
{
fin>>n;
fin>>x.x>>x.y;
fin>>v[1].x>>v[1].y;
for (int i=3;i<=n;i++)
{
fin>>v[i].x>>v[i].y;
A+=crossproduct(v[i],x,v[i-1]);
}
if (A<=0)
fout << setprecision(5) << fixed <<A*-1;
else
fout<< setprecision(5) << fixed << A;
return 0;
}