Pagini recente » Cod sursa (job #689751) | Cod sursa (job #1418802) | Cod sursa (job #1140322) | Cod sursa (job #698465) | Cod sursa (job #1383131)
#include <fstream>
#include <iomanip>
#define NMax 100010
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
int n;
double surface;
struct mPoint
{
double x;
double y;
}points[NMax];
int main()
{
f >> n;
for (int i = 1; i <= n; i++)
f >> points[i].x >> points[i].y;
for (int i = 1; i <= n - 1; i++)
surface += points[i].x * points[i + 1].y - points[i + 1].x * points[i].y;
surface += points[n].x * points[1].y - points[1].x * points[n].y;
surface /= 2;
g << setprecision(5) << fixed << surface;
return 0;
}