Keiichi Tsuchiya the Drift King

 1 #include<iostream>
 2 #include<cmath>
 3 #include<cstdio>
 4 #include<algorithm>
 5 #include<iomanip>
 6 #define pi acos(-1)
 7 using namespace std;
 8 
 9 int main(){
10     int T;scanf("%d",&T);
11     while(T--){
12         double a, b, r, d, res;
13         scanf("%lf%lf%lf%lf",&a,&b,&r,&d);
14         d = d / 180 * pi;
15         double t = atan(b / (a + r));
16         if(d >= t){
17             res = sqrt((a + r) * (a + r) + b * b) - r;
18         }else{
19             t -= d;
20             res = sqrt((a + r) * (a + r) + b * b) * cos(t) - r;
21         }
22         cout << setprecision(20) << res << endl;
23     }
24     return 0;
25 }

参考文献:https://blog.csdn.net/xiao_you_you/article/details/89357815

思维题总能想到一部分情况

比如说本题,入弯之后就是勾股定理。

也能想象得出入弯前是关键,但就是画不出图......

蛮简单的一道签到题。

posted @ 2020-10-08 16:57  LegendN  阅读(83)  评论(0)    收藏  举报