Pagini recente » Cod sursa (job #2934760) | Cod sursa (job #1440039) | Cod sursa (job #1355591) | Cod sursa (job #3147531) | Cod sursa (job #2718486)
#include <fstream>
#include <iomanip>
using namespace std;
const int N = 100000;
double x[N], y[N];
int main()
{
ifstream in("aria.in");
ofstream out("aria.out");
int n;
long double aria = 0;
in >> n >> x[0] >> y[0];
for (int i = 1; i < n; i++)
{
in >> x[i] >> y[i];
aria += (x[i] - x[i-1]) * (y[i] + y[i-1]);
}
in.close();
aria += (x[0] - x[n-1]) * (y[0] + y[n-1]);
if (aria < 0)
{
aria = -aria;
}
out << setprecision(6) << fixed << aria / 2;
out.close();
return 0;
}