QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#217331#7032. Keiichi Tsuchiya the Drift KingzzzyzzzAC ✓25ms4492kbC++17679b2023-10-16 19:19:252023-10-16 19:19:26

Judging History

你现在查看的是最新测评结果

  • [2023-10-16 19:19:26]
  • 评测
  • 测评结果:AC
  • 用时:25ms
  • 内存:4492kb
  • [2023-10-16 19:19:25]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const double eps=1e-8;
int w[100010];
int idx[100010];
int a,b,r,x;
double check(double x) {
	double s=(double)x*acos(-1)/180;
	double res=a*cos(s)+b*sin(s)-r*sin(s)*tan(s);
	return res;
}

int main() {
	int T;
	cin>>T;
	
	while(T--) {
		
		cin>>a>>b>>r>>x;
		double res=sqrt((r+a)*(r+a)+b*b);
		
		double s=(double)x*acos(-1)/180;
		if((double)b/(a+r)<=tan(s)||x>=90) 
			printf("%.15f\n",res-r);
		else {
			double s1=(double)b/(a+r);
			double x1=atan(s1)-(double)x*acos(-1)/180;
			printf("%.15f\n",res*cos(x1)-r);
			
			// printf("%.15f\n",check(l));
		}
	}
	return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4272kb

input:

4
1 2 2 120
1 2 2 60
1 2 2 30
1 2 2 15

output:

1.605551275463989
1.605551275463989
1.598076211353316
1.415415569072246

result:

ok 4 numbers

Test #2:

score: 0
Accepted
time: 19ms
memory: 4452kb

input:

10000
17 35 10 70
56 65 64 74
54 58 75 31
56 9 87 44
33 60 39 8
39 52 4 94
63 99 76 134
15 91 16 149
21 85 94 71
98 9 34 116
8 6 13 134
18 68 26 85
21 20 61 117
73 18 49 64
41 25 66 32
19 72 94 110
80 38 92 152
62 46 67 157
38 72 79 139
75 18 9 124
73 23 96 150
1 26 49 114
36 76 66 38
80 34 23 88
69...

output:

34.204072210600685
72.473440639561801
66.439032802122910
56.282936876656748
40.649687006996984
63.475921631349351
94.651692051382838
80.135321292436529
49.003496460750910
98.306462427199676
8.840329667841555
54.993826925266347
23.403791384036765
74.320720075743964
43.881754627417564
39.9888055025493...

result:

ok 10000 numbers

Test #3:

score: 0
Accepted
time: 25ms
memory: 4492kb

input:

10000
99 1 1 99
99 1 1 98
98 1 1 98
97 1 1 98
97 1 1 97
97 1 1 96
96 1 1 96
92 1 1 99
93 1 1 97
95 1 1 94
94 1 1 94
90 1 1 97
93 1 1 93
89 1 1 96
98 1 1 86
99 1 1 84
84 1 1 98
89 1 1 92
95 1 1 85
81 1 1 98
92 1 1 86
95 1 1 82
84 1 1 92
89 1 1 86
95 1 1 79
79 1 1 94
87 1 1 85
90 1 1 81
77 1 1 93
94 1...

output:

99.004999875006249
99.004999875006249
98.005050376230813
97.005101908012932
97.005101908012932
97.005101908012932
96.005154502222197
92.005376188691372
93.005318998448161
95.005208192055917
94.005263012108969
90.005494339627646
93.005318998448161
89.005555384098372
98.005050376230813
99.004999875006...

result:

ok 10000 numbers

Test #4:

score: 0
Accepted
time: 15ms
memory: 4196kb

input:

10000
1 99 88 1
1 99 89 1
1 97 88 1
1 97 89 1
1 95 88 1
1 95 89 1
1 93 88 1
1 93 89 1
1 91 88 1
1 91 89 1
1 89 88 1
1 89 89 1
1 87 88 1
1 87 89 1
1 85 88 1
1 85 89 1
1 83 88 1
1 83 89 1
1 81 88 1
1 81 89 1
1 79 88 1
1 79 89 1
1 77 88 1
1 77 89 1
1 75 88 1
1 75 89 1
1 73 88 1
1 73 89 1
1 71 88 1
1 71...

output:

2.714233106209903
2.714080801366279
2.679328293335331
2.679175988491721
2.644423480460745
2.644271175617149
2.609518667586187
2.609366362742577
2.574613854711615
2.574461549868019
2.539709041837057
2.539556736993447
2.504804228962485
2.504651924118875
2.469899416087912
2.469747111244317
2.4349946032...

result:

ok 10000 numbers