Pagini recente » Cod sursa (job #1801380) | Cod sursa (job #1859338) | Cod sursa (job #1274241) | Cod sursa (job #1841115) | Cod sursa (job #899152)
Cod sursa(job #899152)
#include <fstream>
#include <iomanip>
#define MAXN 100005
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
int n;
long double x[MAXN],y[MAXN],a;
int main()
{
int i;
f>>n;
f>>x[1]>>y[1];
for(i=2;i<=n;i++){
f>>x[i]>>y[i];
a+=((y[i]+y[i-1])*(x[i]-x[i-1])/2);}
a+=(y[1]+y[n])*(x[1]-x[n])/2;
g<<fixed<<setprecision(7)<<((a>0)?a:(-a));
f.close();
g.close();
return 0;
}