gym101962 G. Barra Lighthouse

简单计算几何分类讨论一下

#include
#define mp make_pair
#define fir first
#define sec second
using namespace std;
typedef long long ll;
const double eps = 1e-12;
const double PI = acos(-1.0);
const int MX = 2e5+7;

double ans[MX];
struct Point {
    double x, y;
    Point() {}
    Point(double x,double y):x(x),y(y) {}
}p[MX];
typedef Point Vector;

int dcmp(double x) { //返回x的正负
    if(fabs(x) 0){
        if(si+a < sums) return ti;
        if(si > sums) return 0;
        return (sums - si)*ti/a;
    }
    else{
        if(si+a > sums) return sums*ti/a;
        double ans = (si+a)*ti/a;
        double ra = PI*2-sums;
        if(ra < -si) ans += (-si-ra)*ti/a;
        return ans;
    }
    return 0;
}


int main()
{
#ifdef LOCAL
    freopen("input.txt","r",stdin);
#endif // LOCAL
    int n,X;
    double a,T,d;
    scanf("%d%d",&n,&X);
    scanf("%lf%lf%lf",&a,&T,&d);
    for(int i = 1; i<= n; i++){
        scanf("%lf%lf",&p[i].x,&p[i].y);
    }
    double t = X/T;
    double rem = t - floor(t);
    t = floor(t);
    double ti = a/360*T;
    double tnow = ti*t;
    for(int i = 1; i <= n; i++) {
        if(Length2(p[i]) < d*d + eps){
            ans[i] = tnow + get_t(p[i],a*PI/180,PI*2*rem,ti);
        }
        else ans[i] = 0;
    }
    for(int i = 1; i<= n; i++)
        printf("%.11f\n",ans[i]);
    return 0;
}
/*
4 2
abcd
bcde
bcad
bcde
*/

 

你可能感兴趣的:(几何问题)