QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#177107#5461. Paddle StarlostintianyiAC ✓85ms4496kbC++171.2kb2023-09-12 15:57:282023-09-12 15:57:28

Judging History

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

  • [2023-09-12 15:57:28]
  • 评测
  • 测评结果:AC
  • 用时:85ms
  • 内存:4496kb
  • [2023-09-12 15:57:28]
  • 提交

answer

#include <bits/stdc++.h>
using i64 = int64_t;
using f64 = double;
using f128 = long double;

const f64 pi = acos(-1.0);
constexpr f64 eps = 1e-9;

inline int dcmp(double x) {
	return (x > eps) - (x < -eps);
}

inline f64 Carea(f64 alpha, f64 r) {
	return alpha * r * r;
}

void solve() {
	double l1, l2, alpha, beta;
	scanf("%lf%lf%lf%lf", &l1, &l2, &alpha, &beta);
	alpha = alpha * pi / 180;
	beta = beta * pi / 180;

	if (dcmp(beta - pi / 2) <= 0) {
		printf("%.7lf\n", Carea(alpha, l1 + l2) + Carea(beta, l2));
	} else {
		// l3 的角度
		f64 angel = pi - beta;	
		// 余弦
		f64 l3 = sqrt(l1 * l1 + l2 * l2 - 2.0 * l1 * l2 * cos(angel));
		// l2 与 l3 的夹角 >= 90
		f64 div;
		if (dcmp(l2 * l2 + l3 * l3 - l1 * l1) >= 0) {
			l3 = l1 * sin(angel);
			div = beta - pi / 2;
		} else {
			div = asin(l2 / l3 * sin(angel));
		}
		f64 S = l1 * l3 * sin(div) - Carea(div, l3);
		f64 S2 = 0;
		if (dcmp(div - 2 * alpha) == 1) {
			f64 l4 = l3 * sin(angel + div) / sin(2 * alpha + angel);
			S2 = l3 * l4 * sin(div - 2 * alpha) - Carea(div - 2 * alpha, l3);
		}
		printf("%.7lf\n", Carea(alpha, l1 + l2) + Carea(beta, l2) + S - S2);
	}
}

int main() {
	int T;
	scanf("%d", &T);

	while (T--) {
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 4412kb

input:

5
2 1 20 20
3 3 0 0
20 20 90 120
20 10 50 170
100 10 1 93

output:

3.4906585
0.0000000
3367.1576119
1098.8632790
373.9604896

result:

ok 5 numbers

Test #2:

score: 0
Accepted
time: 66ms
memory: 4352kb

input:

100000
88 12 24 116
79 15 84 150
96 52 31 141
100 100 81 29
83 29 71 99
95 92 5 87
99 97 39 72
79 72 20 65
67 39 60 116
100 89 1 62
78 77 63 45
62 34 83 178
92 49 24 103
94 73 66 49
20 14 24 51
100 97 66 109
94 94 86 82
82 79 49 67
76 38 88 118
92 79 58 112
93 23 40 167
87 34 13 25
96 18 73 15
94 38...

output:

4526.9916132
13636.4792655
19433.1705026
61610.1225954
17006.2337270
15903.6670370
37972.6398435
13840.1119025
14968.8045203
9194.7959252
31073.4929367
16982.1207432
12675.9304202
36683.2429520
658.6872597
62718.1972158
65696.5666928
29465.9748824
23128.0289502
41946.0282993
11050.5789317
3826.33767...

result:

ok 100000 numbers

Test #3:

score: 0
Accepted
time: 51ms
memory: 4316kb

input:

100000
1 1 0 0
1 1 0 1
1 1 0 2
1 1 0 3
1 1 0 4
1 1 0 5
1 1 0 6
1 1 0 7
1 1 0 8
1 1 0 9
1 1 0 10
1 1 0 11
1 1 0 12
1 1 0 13
1 1 0 14
1 1 0 15
1 1 0 16
1 1 0 17
1 1 0 18
1 1 0 19
1 1 0 20
1 1 0 21
1 1 0 22
1 1 0 23
1 1 0 24
1 1 0 25
1 1 0 26
1 1 0 27
1 1 0 28
1 1 0 29
1 1 0 30
1 1 0 31
1 1 0 32
1 1 0 ...

output:

0.0000000
0.0174533
0.0349066
0.0523599
0.0698132
0.0872665
0.1047198
0.1221730
0.1396263
0.1570796
0.1745329
0.1919862
0.2094395
0.2268928
0.2443461
0.2617994
0.2792527
0.2967060
0.3141593
0.3316126
0.3490659
0.3665191
0.3839724
0.4014257
0.4188790
0.4363323
0.4537856
0.4712389
0.4886922
0.5061455
...

result:

ok 100000 numbers

Test #4:

score: 0
Accepted
time: 51ms
memory: 4220kb

input:

100000
1 1 0 0
1 1 0 1
1 1 0 2
1 1 0 3
1 1 0 4
1 1 0 5
1 1 0 6
1 1 0 7
1 1 0 8
1 1 0 9
1 1 0 10
1 1 0 11
1 1 0 12
1 1 0 13
1 1 0 14
1 1 0 15
1 1 0 16
1 1 0 17
1 1 0 18
1 1 0 19
1 1 0 20
1 1 0 21
1 1 0 22
1 1 0 23
1 1 0 24
1 1 0 25
1 1 0 26
1 1 0 27
1 1 0 28
1 1 0 29
1 1 0 30
1 1 0 31
1 1 0 32
1 1 0 ...

output:

0.0000000
0.0174533
0.0349066
0.0523599
0.0698132
0.0872665
0.1047198
0.1221730
0.1396263
0.1570796
0.1745329
0.1919862
0.2094395
0.2268928
0.2443461
0.2617994
0.2792527
0.2967060
0.3141593
0.3316126
0.3490659
0.3665191
0.3839724
0.4014257
0.4188790
0.4363323
0.4537856
0.4712389
0.4886922
0.5061455
...

result:

ok 100000 numbers

Test #5:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

1
1 1 0 0

output:

0.0000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #6:

score: 0
Accepted
time: 51ms
memory: 4432kb

input:

100000
2 1 24 89
3 1 76 68
2 2 52 144
3 3 4 2
2 2 86 44
3 2 87 123
3 2 2 53
3 1 50 172
3 3 86 156
2 2 46 1
3 3 74 71
2 2 20 104
2 2 29 86
3 3 2 30
2 2 26 178
3 2 14 108
3 3 90 69
3 2 13 175
3 3 52 35
2 2 73 31
3 3 77 105
3 1 86 143
3 3 50 109
3 1 13 94
3 2 41 139
2 2 51 154
2 1 57 40
3 3 27 112
2 2 ...

output:

5.3232542
22.4100276
25.1738766
2.8274334
27.0875100
47.0128861
4.5727626
17.1015257
80.1688642
12.9154365
57.6482252
12.8643846
14.1022604
5.9690260
19.8188657
13.7360709
67.3871624
18.2334377
38.1703507
22.5496539
64.9255289
26.9271291
48.6399124
5.2719121
28.6835679
25.7105159
9.6516708
34.712675...

result:

ok 100000 numbers

Test #7:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

1
1 1 1 1

output:

0.0872665

result:

ok found '0.0872665', expected '0.0872665', error '0.0000000'

Test #8:

score: 0
Accepted
time: 66ms
memory: 4220kb

input:

100000
71 6 33 34
98 20 79 171
88 16 59 8
45 21 36 79
88 61 44 149
55 47 72 86
81 8 85 122
68 2 35 71
98 91 79 49
73 19 68 148
69 66 81 22
99 94 87 130
65 53 43 53
97 89 84 1
93 88 77 6
83 46 2 51
83 69 46 95
91 55 17 137
93 84 1 54
61 45 74 15
77 65 0 21
84 71 6 32
87 81 37 76
91 55 32 154
73 34 76...

output:

3436.2216846
20453.8997142
11173.4582449
3345.0107779
27858.1254430
16389.7237804
11913.3689208
2998.1964022
56334.4809588
11128.1167241
27437.5706790
77419.2591703
13048.2385675
50858.6326037
44838.5731346
2464.3699972
26444.6360923
14434.0150804
7196.9175305
15041.9281721
1548.5433788
5331.3176397...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 60ms
memory: 4288kb

input:

100000
10 1 40 160
6 6 27 16
10 10 7 41
4 1 38 161
7 6 66 143
6 4 26 127
8 4 47 99
4 4 49 121
5 2 68 122
8 8 27 178
10 8 73 125
6 2 20 175
10 1 34 13
7 4 66 102
10 10 14 179
9 7 64 120
7 5 47 169
10 8 68 90
8 2 37 3
5 5 10 164
4 2 26 62
7 5 43 40
1 1 35 103
10 7 71 102
6 1 90 63
6 4 49 44
6 3 84 123...

output:

87.5849134
77.9114978
120.4277184
19.6909240
291.6581829
83.3184896
145.8513632
89.2261954
67.6719994
321.5712287
558.4265732
34.9039348
72.0297382
168.0119006
411.8275153
391.8455079
196.2804722
485.0619057
64.7866218
92.3584692
20.6646983
125.5240798
4.2449243
445.6538962
78.0685774
97.8082513
139...

result:

ok 100000 numbers

Test #10:

score: 0
Accepted
time: 60ms
memory: 4308kb

input:

100000
8 8 89 18
10 1 17 44
6 1 43 5
11 10 84 74
11 11 64 172
10 7 85 51
7 6 71 176
9 7 51 99
5 3 12 54
6 5 26 32
3 2 21 23
10 10 59 151
9 9 81 45
7 4 2 37
11 6 3 172
11 10 65 98
11 10 78 173
7 2 9 104
10 9 46 77
8 3 24 100
11 9 77 41
10 10 55 30
11 6 37 75
9 7 25 56
10 9 14 7
9 9 12 179
11 9 6 130
...

output:

417.7620098
36.6693676
36.8613538
775.6941328
917.1929866
472.3559088
322.4645901
312.6392122
21.8864288
68.8706923
10.7686815
692.8212327
521.6614601
14.5560460
127.7263970
671.4494073
913.4668883
20.2138464
398.6855610
66.5036821
595.5237941
436.3323130
233.7519467
159.5929068
98.1049573
322.26387...

result:

ok 100000 numbers

Test #11:

score: 0
Accepted
time: 62ms
memory: 4320kb

input:

100000
7 3 55 160
4 3 14 72
9 7 4 52
9 9 31 71
12 1 87 116
9 7 10 154
12 10 20 100
6 5 61 69
12 12 55 130
12 11 7 163
4 3 43 178
11 11 42 155
12 1 20 1
5 3 72 151
7 2 74 136
10 10 66 76
11 11 84 176
8 6 59 110
12 2 54 47
12 12 38 28
12 12 38 105
12 12 60 173
12 4 48 76
2 1 71 31
3 1 21 123
12 7 83 2...

output:

123.8481688
23.2826922
62.3431609
275.6747554
258.9925309
187.4182443
343.7313508
158.9296817
891.5581093
425.5736016
65.0474040
703.9554219
59.0095820
107.1528554
115.7908512
593.4119457
1088.8025992
271.7872108
188.0068670
452.3893421
646.7376994
1052.3024075
235.6892622
11.6937060
8.3112306
541.7...

result:

ok 100000 numbers

Test #12:

score: 0
Accepted
time: 53ms
memory: 4300kb

input:

100000
12 8 12 17
7 1 3 24
13 13 40 16
9 9 77 68
11 1 2 137
8 5 43 153
11 10 60 93
9 4 54 124
13 11 90 62
13 11 23 10
9 5 65 152
13 10 81 159
9 5 0 100
2 1 8 10
13 4 29 108
11 9 33 62
1 1 7 0
7 6 9 117
10 7 79 17
6 3 44 136
9 1 89 169
12 12 90 59
11 11 67 48
8 2 50 165
12 3 36 39
11 2 46 157
12 7 57...

output:

102.7649864
3.7699112
519.1307327
531.5574770
7.8958553
201.6594478
624.1355207
197.8859939
1035.7132847
252.3397033
297.2487708
1051.6114312
43.6332313
1.4311700
178.0801015
318.0338963
0.4886922
101.4983432
413.0147142
86.5755165
158.4706356
1053.0618575
667.3440928
99.7704197
147.4977751
148.0465...

result:

ok 100000 numbers

Test #13:

score: 0
Accepted
time: 62ms
memory: 4284kb

input:

100000
16 6 41 45
19 4 51 119
1 1 20 49
20 20 68 30
20 20 56 133
16 6 69 27
13 12 17 12
11 6 33 146
12 9 51 156
7 7 6 125
20 17 76 123
20 13 14 80
20 20 50 160
10 9 89 177
13 4 0 61
18 4 65 36
10 5 34 167
17 15 73 74
18 1 26 107
17 8 6 65
10 5 14 130
19 6 51 73
11 1 75 177
14 3 76 96
8 3 31 9
7 5 13...

output:

374.6174706
509.2284554
2.2514747
2108.3577364
2531.2743370
599.8347573
215.6005225
270.9268661
635.7110655
129.6061759
2456.9872192
502.0614126
2584.6655180
815.1520058
17.0344135
559.1336792
211.6815885
1595.2658429
165.9307957
138.0555438
118.7941334
602.1909518
191.6370467
398.4982964
66.8810169...

result:

ok 100000 numbers

Test #14:

score: 0
Accepted
time: 60ms
memory: 4348kb

input:

100000
21 19 6 6
17 6 48 147
16 10 56 89
18 18 89 19
19 18 79 85
15 7 12 18
20 18 57 117
17 16 36 117
9 6 12 81
20 19 4 76
19 18 7 97
21 2 79 160
21 19 5 4
21 19 25 119
14 10 54 129
21 17 49 21
21 13 48 179
14 14 31 80
18 17 51 1
8 4 37 1
13 9 90 118
14 14 47 64
16 11 3 74
20 15 30 42
19 19 38 133
1...

output:

205.3554398
550.0648679
816.0461451
2120.5750412
2368.2547153
116.7625270
2110.3231779
1215.7841713
98.0176908
585.0343653
715.9944571
741.8350733
164.8288946
1464.1555390
783.2976070
1340.8491978
1499.3758820
697.8524481
1095.4384517
93.2703952
932.7515910
862.0530241
194.4471320
806.3421144
1830.8...

result:

ok 100000 numbers

Test #15:

score: 0
Accepted
time: 63ms
memory: 4220kb

input:

100000
14 12 55 44
19 19 55 175
18 18 25 53
18 12 61 16
22 19 85 30
21 17 53 122
22 22 80 110
20 17 46 87
19 11 64 165
5 1 20 110
19 6 46 176
22 22 45 164
22 18 77 35
22 4 69 53
17 2 34 93
22 17 33 179
16 12 79 106
17 17 64 87
22 16 60 76
12 4 43 109
18 10 51 174
11 8 60 26
19 17 5 46
14 12 75 101
2...

output:

759.4974773
2516.0276065
865.1946168
998.3981453
2682.8328597
1972.1516299
3638.7491159
1537.9317770
1382.2181529
14.6898172
614.8675823
2986.6507445
2348.1659756
828.8917684
220.7281429
1783.9488861
1349.1665832
1730.0925276
1851.7245232
224.2012814
1011.8411110
407.0805947
345.1214063
1139.1747749...

result:

ok 100000 numbers

Test #16:

score: 0
Accepted
time: 63ms
memory: 4408kb

input:

100000
22 20 49 129
22 1 9 42
29 27 41 134
29 29 72 80
27 16 71 123
28 7 21 71
25 13 70 133
28 11 27 60
29 28 68 3
23 5 1 168
27 22 79 16
29 10 17 81
27 15 90 119
29 28 86 79
22 21 69 122
27 27 49 139
16 8 11 97
16 11 4 58
12 11 32 128
18 8 35 146
29 22 27 19
30 15 50 115
15 2 24 72
18 6 80 158
13 6...

output:

2446.9221492
83.8281640
4035.0701227
5401.5845954
2878.4814120
509.7059548
2207.4158578
843.4652676
3897.0409670
91.3684403
3445.6813692
592.6614541
3265.0553100
5957.6814017
3188.8309213
4354.9676824
219.0883237
173.3810079
576.3227095
600.6006400
1386.1928518
2240.9092181
126.0825852
915.4211564
5...

result:

ok 100000 numbers

Test #17:

score: 0
Accepted
time: 63ms
memory: 4480kb

input:

100000
39 35 57 118
18 2 33 138
37 28 62 114
40 2 11 130
11 9 78 113
23 17 47 122
29 7 65 143
36 27 11 77
24 19 77 38
34 30 5 12
12 2 74 14
38 31 37 82
36 34 15 85
39 27 17 161
37 15 46 80
40 14 33 54
37 30 88 95
40 22 9 111
36 36 12 52
40 40 48 151
40 39 41 163
21 16 42 73
18 2 64 146
40 37 84 152
...

output:

8021.6129252
241.9100913
6161.9004643
349.6471069
706.6558630
1953.1039105
1613.9959825
1741.6989672
2724.3018827
545.9389900
254.1199391
4449.8740076
2997.7775232
3534.1587472
2485.0696022
1864.2210806
8387.1674436
1565.5957228
2261.9467106
9856.4279303
9066.1356437
1329.6965439
458.7943660
12605.8...

result:

ok 100000 numbers

Test #18:

score: 0
Accepted
time: 65ms
memory: 4476kb

input:

100000
9 8 74 2
47 41 64 61
42 1 75 10
33 29 33 75
43 1 76 103
48 12 73 90
50 50 35 160
50 48 13 179
49 46 77 169
30 18 74 55
44 43 77 164
15 2 31 91
49 43 31 120
49 36 39 131
43 8 23 142
33 31 25 74
25 6 58 129
28 20 31 95
8 7 1 148
37 10 52 156
11 5 54 52
49 26 33 2
20 17 13 33
38 23 89 34
50 7 60...

output:

375.4901353
10439.8090939
2420.5098731
3314.8514884
2570.0101069
4812.9199453
13536.1656096
9417.1108767
18693.8565478
3286.7342342
15787.4617963
162.7174448
8548.7942510
8091.2507086
1231.6104294
3028.3905983
1068.3169862
1909.9819629
131.9875637
2312.6503165
263.9635961
3263.3642755
477.0682977
60...

result:

ok 100000 numbers

Test #19:

score: 0
Accepted
time: 77ms
memory: 4496kb

input:

100000
985040437 963837006 74 178
562320397 456498961 21 57
616458849 43215539 12 112
967049313 962181597 55 20
404875500 323494205 16 148
822013814 350801410 65 117
493753261 325808227 72 151
883524417 55981080 1 165
756475575 306464991 75 65
982861539 971158777 53 2
977914232 494619050 34 80
92912...

output:

7823031139236862976.0000000
587759779770854528.0000000
95369829970997632.0000000
3895961013788279808.0000000
443752067877684992.0000000
1832058841745101824.0000000
1157411971581695232.0000000
25211463877824920.0000000
1585510323477645056.0000000
3564846423752922112.0000000
1628320379389401600.000000...

result:

ok 100000 numbers

Test #20:

score: 0
Accepted
time: 85ms
memory: 4380kb

input:

100000
915624482 436335283 31 93
966989692 899762255 14 172
971565321 859650888 86 78
840892426 595383046 16 116
992919354 525701445 9 98
924698821 417910701 18 49
923077550 641792877 68 62
918753914 850646822 29 137
935549247 897719522 87 46
937380829 805246200 55 11
434960395 174040501 0 56
902102...

output:

1298002666918420224.0000000
3375253522633562112.0000000
6039368287407980544.0000000
1313133658442171648.0000000
835838455087290240.0000000
715665701891950464.0000000
3352034067230078976.0000000
3413794084111542784.0000000
5750292420404998144.0000000
3039557717337095168.0000000
29605066721524104.0000...

result:

ok 100000 numbers