hdoj:2036

#include <iostream>
using namespace std;
struct Point
{
int x, y; };
Point a[];
int main()
{
int n;
while (cin >> n && n != )
{
for (int i = ; i <= n; i++)
{
cin >> a[i].x >> a[i].y;
} double area = 0.0;
for (int i = ; i < n; i++)
{
int x1 = a[i].x;
int y1 = a[i].y;
int x2 = a[i + ].x;
int y2 = a[i + ].y;
area += 0.5*abs(x1*y2 - y1*x2);
}
int x1 = a[].x;
int y1 = a[].y;
int x2 = a[n].x;
int y2 = a[n].y;
area += 0.5*abs(x1*y2 - y1*x2);
printf("%.1lf\n", area);
}
}
上一篇:Android Fragment详解(二):Fragment创建及其生命周期


下一篇:day 3 大纲笔记