多边形的面积
http://acm.hdu.edu.cn/vcontest/vtl/problem/showproblem/vtlid/1816/problemid/1005
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include"iostream"
using namespace std;
int main()
{
int t;
int n,i;
int x[101],y[101];
cin>>t;
while(t--)
{
double sum=0;
cin>>n;
for(i=0;i<n;i++) cin>>x[i]>>y[i];
for(i=1;i<n;i++)
{
sum+=x[i]*y[i-1]-x[i-1]*y[i];
}
sum+=y[n-1]*x[0]-x[n-1]*y[0];
if(sum<0) sum=-sum;
printf("%.1lf\n",sum*0.5);
}
return 0;
}