Pagini recente » Cod sursa (job #167579) | Cod sursa (job #1993852) | <3 ;] <3 | Cod sursa (job #186469) | Cod sursa (job #1974089)
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
int main()
{
long double a = 0;
double x1, x2, y1, y2;
int N;
fin >> N;
fin >> x1 >> y1;
double x = x1, y = y1;
for(int i = 2; i <= N; i++)
{
fin >> x2 >> y2;
a += x1 * y2 - x2 * y1;
x1 = x2, y1 = y2;
}
a += x1 * y - x * y1;
fout << fixed << setprecision(5) << a / 2;
return 0;
}