#include <iostream>
#include <cmath>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <climits>
#define testDo if(isTest)
#define isTest 1
#define mem(a) memset(a,0,sizeof(a))
#define lson k<<1, l, mid
#define rson (k<<1)|1, mid+1, r
#define PI 3.141592653579
using namespace std;
typedef long long ll;
double charge(double x1,double y1,double x2,double y2){
return x1*y2-x2*y1;//<0rigtht ,=0in,>0left
}
double angle2(double x1,double y1,double x2,double y2){
return acos((x1*x2+y1*y2)/sqrt(x1*x1+y1*y1)/sqrt(x2*x2+y2*y2));
}
int main()
{
double k,h,x[110],y[110];
int n;
scanf("%lf%lf%d",&k,&h,&n);
for(int i=0;i<n;i++){
scanf("%lf%lf",&x[i],&y[i]);
}
double angle=0,maxa=0,mina=0;
for(int i=0;i<n;i++){
int j=(i+1)%n;
double cha=0;
double add=angle2(x[i],y[i],x[j],y[j]);
if((cha=charge(x[i],y[i],x[j],y[j]))<0)add=-add;
else if(cha==0)continue;
angle+=add;
maxa=max(maxa,angle);
mina=min(angle,mina);
}
if(maxa-mina>2*PI)
maxa=mina+2*PI;
printf("%.2lf",(maxa-mina)*k*h);
return 0;
}
POJ1031
最新推荐文章于 2019-09-21 00:52:51 发布