-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathC.cpp
More file actions
66 lines (62 loc) · 1.62 KB
/
Copy pathC.cpp
File metadata and controls
66 lines (62 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include<bits/stdc++.h>
#define pi acos(-1)
using namespace std;
int main()
{
int tc;
cin>>tc;
while(tc--){
double S,N,theta,T1,T2,T3,T4;
cin>>S>>N>>T1>>T2>>T3;
double s,v,phi,Ra,t;
double w=2*pi*N/60.0;
T4=60/N-T1-T2-T3;
theta=0;
vector<pair<double,double>>ans;
while(theta<=360){
t=(pi*theta/180.0)/w;
if(t<T1){
s=0.5*S*(1-cos(pi*t/T1))+50;
v=pi/2 * S/T1 * sin((pi*t)/T1);
phi=atan2(v,(w*s));
Ra=s/cos(phi);
}
else if(t-T1<T2){
s=S+50;
v=0;
phi=0;
Ra=s;
}
else if(t-T1-T2<T3){
s=S/2 *(1-cos((pi*t)/T3))+50;
v=pi/2 * S/T3 * sin((pi*t)/T3);
phi=atan2(v,(w*s));
Ra=s/cos(phi);
}
else{
s=50;
v=0;
phi=0;
Ra=s;
}
//scout<<t<<" "<<Ra<<endl;
ans.push_back(make_pair((pi*theta/180.0+phi),Ra));
theta+=0.01;
}
int x;double min=1e9;
int n;
cin>>n;
while(n--){
cin>>theta;
x=0;
min=1e9;
theta=theta*pi/180.0;
for(int i=0;i<ans.size();i++)
if(fabs(theta-ans[i].first)<min){
min=fabs(theta-ans[i].first);
x=i;
}
printf("%.3f\n",ans[x].second);
}
}
}