Pagini recente » Cod sursa (job #1633552) | Cod sursa (job #163911) | Cod sursa (job #1027945) | Cod sursa (job #354979) | Cod sursa (job #1974083)
#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, x3, y1, y2, y3;
int N;
fin>>N;
fin>>x1>>y1>>x2>>y2;
for(int i = 3; i <= N; i++)
{
fin>>x3>>y3;
a += x1 * y2 + x2 * y3 + y1 * x3 - x3 * y2 - x1 * y3 - x2 * y1;
x2 = x3, y2 = y3;
}
fout<<fixed<<setprecision(5)<<a * 0.5;
return 0;
}