标签:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2036
#include<iostream> #include<stdio.h> #include<string.h> #include<string> #include<vector> #include<algorithm> #include<map> #include<queue> using namespace std; #define met(a, b) memset(a, b, sizeof(a)) #define N 111 typedef long long LL; struct point { int x, y; point(){} point(int x, int y):x(x), y(y) {} friend int operator ^(point p, point q) { return p.x*q.y-p.y*q.x; }; }p[N]; int main() { int n; while(scanf("%d", &n), n) { for(int i=1; i<=n; i++) scanf("%d %d", &p[i].x, &p[i].y); p[0] = p[n]; int S = 0; for(int i=1; i<=n; i++) { S += p[i]^p[i-1]; } printf("%.1f\n", abs(S)/2.0); } return 0; }
标签:
原文地址:http://www.cnblogs.com/zhengguiping--9876/p/5724884.html