Pagini recente » Cod sursa (job #2433069) | Cod sursa (job #1499549) | Cod sursa (job #476747) | Cod sursa (job #668865) | Cod sursa (job #1775732)
//
// main.cpp
// Aria
//
// Created by Albastroiu Radu on 10/10/16.
// Copyright © 2016 Albastroiu Radu. All rights reserved.
//
#include <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <unordered_map>
#include <vector>
#include <cmath>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
long long i, n;
long double h, m, x, y, A;
struct pn
{
long double x, y;
}punct, first;
// Punctul de test este ( 0, 0 )
int main()
{
fin >> n;
fin >> x >> y;
punct.x = first.x = x;
punct.y = first.y = y;
for(i=2;i<=n;i++)
{
fin >> x >> y;
A += 0.5 * (punct.x * y - x * punct.y);
punct.x = x;
punct.y = y;
}
A += 0.5 * (punct.x * first.y - first.x * punct.y);
fout << A;
return 0;
}