#include<iostream>
#include<iomanip>
using namespace std;
struct point
{int x;
int y;
};
int main()
{struct point*p;
int n;
double area;
while(cin>>n&&n)
{p=new struct point[n];
for(int i=0;i<n;i++)
cin>>p[i].x>>p[i].y;
area=0.0;
for(int i=0;i<n-1;i++)
{area+=p[i].x*p[i+1].y-p[i+1].x*p[i].y;
}
area+=p[n-1].x*p[0].y-p[0].x*p[n-1].y;
cout<<fixed<<setprecision(1)<<area/2<<endl;
delete[]p;
}return 0;
}
hdu 2036 改革春风吹满地
最新推荐文章于 2024-02-29 12:21:46 发布