Pagini recente » Cod sursa (job #2934316) | Cod sursa (job #460121) | Cod sursa (job #1110605) | Cod sursa (job #1956622) | Cod sursa (job #2712452)
#include <bits/stdc++.h>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
int n,i;
long double A,x,y,new_x,new_y,first_x,first_y;
int main()
{
f>>n;
f>>x>>y;
first_x=x;first_y=y;
for(i=2;i<=n;i++)
{
f>>new_x>>new_y;
/// determinant:
/// 0 0 1 (asta e originea)
/// x y 1 (punctul anterior)
/// new_x new_y 1 (punctul curent)
A += (x*new_y - y*new_x);
x=new_x;y=new_y;
}
/// se face si dintre ultimul punct si primul
A += (x*first_y - y*first_x);
/// in final, se impare la 2.0
A /= 2.0;
g<<fixed<<setprecision(5)<<A;
return 0;
}