hdu 2036
水题
AC代码:
#include<iostream> using namespace std; int main() { float n,m,x,y,x1,y1,x2,y2; while(cin>>n,n){ double sum=0.0; cin>>x>>y; x1=x,y1=y; n--; while(n--){ cin>>x2>>y2; sum+=abs(x1*y2-x2*y1); x1=x2,y1=y2;} sum+=abs(x*y2-x2*y); printf("%.1f\n",sum/2);} return 0; }