标签:
3 0 0 1 0 0 1 4 1 0 0 1 -1 0 0 -1 0
0.5 2.0
#include<stdio.h> #include<math.h> struct point{ double x,y; }p[110]; double cross(point a,point b){ return (a.x*b.y-a.y*b.x)/2.0; } int main(){ int n; while(scanf("%d",&n),n){ for(int i=0;i<n;++i){ scanf("%lf%lf",&p[i].x,&p[i].y); } double res=0; for(int i=1;i<=n;++i){ res+=cross(p[i%n],p[i-1]); } printf("%.1lf\n",fabs(res)); } return 0; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/qq_18062811/article/details/46954897