Pagini recente » Cod sursa (job #790267) | Cod sursa (job #2261205) | Cod sursa (job #1331802) | Cod sursa (job #3231677) | Cod sursa (job #2546905)
#include <bits/stdc++.h>
using namespace std;
ifstream ci ("aria.in");
ofstream co ("aria.out");
int a[100001], b[100001];
int main()
{
int n,sum=0;
ci >> n;
for (int i=1; i<=n; i++)
{
ci >> a[i] >> b[i];
}
for (int i=1; i<n; i++)
{
sum+=(a[i+1]-a[i])*(b[i]+b[i+1]);
}
sum+=(a[n]-a[1])*(b[n]+b[1]);
if (sum<0)
{
co << setprecision(6) << fixed << -sum/2.0;
}
else
{
co << setprecision(6) << fixed << sum/2.0;
}
return 0;
}