标签:
Description
Input
Output
Sample Input
1 123.45 67.890 3 0.001 0 1.999 0 0 2 5 10 10 10 12 11 11 12 12 12.0 10.0 0
Sample Output
0 2 3
Hint
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;
int main()
{
float x0,y0,x1,y1;
int n;
while(scanf("%d",&n)!=-1)
{
if(n==0)
break;
float sum=0;
scanf("%f%f",&x0,&y0);
float xx=x0,yy=y0;
n--;
while(n--)
{
scanf("%f%f",&x1,&y1);
sum+=x0*y1-x1*y0;
x0=x1;
y0=y1;
}
x1=xx;
y1=yy;
sum+=x0*y1-x1*y0;
printf("%.0f\n",fabs(sum)/2+1e-6);
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/chen9510/p/4703010.html