Pagini recente » Cod sursa (job #63941) | Cod sursa (job #3127947) | Cod sursa (job #129057) | Cod sursa (job #2741275) | Cod sursa (job #2712635)
#include <fstream>
#include <iomanip>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
int n;
int main()
{
fin >> n;
long double s = 0, x, y, oldX, oldY, firstX, firstY;;
fin >> oldX >> oldY;
firstX = oldX;
firstY = oldY;
for (int i = 2; i <= n; i++)
{
fin >> x >> y;
s += (oldX * y - oldY * x);
oldX = x;
oldY = y;
}
s += (oldX * firstY - oldY * firstX);
s /= 2.0;
fout << fixed << setprecision(5) << s;
fin.close();
fout.close();
return 0;
}