题意:
A国与B国是敌国,A国有一个信号塔,B国有一个信号塔,A国领土是一个凸多边形,当一个位置距B国信号塔的距离是距A国信号塔距离k倍以内的时候,消息将被干扰。
求A国领土上消息被干扰的面积。
思路:
写出方程发现是个圆方程,所以这就是个圆与凸多边形面积交的裸题。。测试下模板。
代码:
#include<bits/stdc++.h>
using namespace std;
const double eps = 1e-12 ;
const double PI = acos( -1.0 ) ;
inline double sqr( double x ){ return x * x ; }
inline int sgn( double x ){
if ( fabs(x) < eps ) return 0 ;
return x > 0? 1 : -1 ;
}
struct Point{
double x , y ;
Point(){}
Point( double _x , double _y ): x(_x) , y(_y) {}
void input() { scanf( "%lf%lf" ,&x ,&y ); }
double norm() { return sqrt( sqr(x) + sqr(y) ); }
friend Point operator + ( const Point &a , const Point &b ) { return Point( a.x + b.x , a.y + b.y ) ; }
friend Point operator - ( const Point &a , const Point &b ) { return Point( a.x - b.x , a.y - b.y ) ; }
friend Point operator * ( const Point &a , const double &b ) {