问题:Keiichi Tsuchiya the Drift King   Gym - 102028D 

参考博客:CodeForces GYM 102028 2018-2019 ACM-ICPC, Asia Jiaozuo Regional Contest

代码:

#include<bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);

int main(){
    int T;
    cin>>T;
    while(T--){
        double a, b, r, d;
        scanf("%lf %lf %lf %lf", &a, &b, &r, &d);
        double tanx = double(b)/(a+r);
        double ans = 0;
        if(tan(d*pi/180) > tanx || (tanx > 0 && tan(d*pi/180) < 0)){
            ans = sqrt((a+r)*(a+r)+b*b)-r;

        }
        else {
            ans = (a+r)*cos(d*pi/180)+b*sin(d*pi/180)-r;
        }
         printf("%.12lf\n", ans);
    }

return 0;
}

 

posted on 2019-04-17 18:20  Refused  阅读(53)  评论(0)    收藏  举报