Pagini recente » Cod sursa (job #1187283) | Cod sursa (job #1411675) | Cod sursa (job #2127295) | Cod sursa (job #1147376) | Cod sursa (job #1451118)
#include <iostream>
#include <fstream>
using namespace std;
int n;
struct p
{
double x,y;
};
p cows[100000];
double ans = 0;
#ifdef home
ifstream fin("input.txt");
ofstream fout("output.txt");
#else
ifstream fin("aria.in");
ofstream fout("aria.out");
#endif
int main()
{
fin>>n;
for (int i=0; i<n; i++)
{
fin>>cows[i].x>>cows[i].y;
}
for (int i=0; i<n; i++)
{
double x=0;
x =
(0.0+cows[i%n].x*cows[(i+1)%n].y-cows[i%n].y*cows[(i+1)%n].x)/2.0;
ans +=x;
}
fout<<ans<<'\n';
return 0;
}