QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#437525#8785. Fake Coin and Lying Scalesucup-team1004AC ✓64ms4152kbC++14698b2024-06-09 12:36:182024-06-09 12:36:18

Judging History

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

  • [2024-06-09 12:36:18]
  • 评测
  • 测评结果:AC
  • 用时:64ms
  • 内存:4152kb
  • [2024-06-09 12:36:18]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include"debug.h"
#else
#define debug(...) void()
#endif
#define all(x) (x).begin(),(x).end()
template<class T>
auto ary(T *a,int l,int r){
	return vector<T>{a+l,a+1+r};
}
using ll=long long;
using ull=unsigned ll;
int T,n,k;
double frac(int n){
	if(!n)return 0;
	return n*(log(n)-1)+1;
}
double C(int n,int k){
	return frac(n)-frac(k)-frac(n-k);
}
double calc(int n,int k){
	k=min(k,n*2/3);
	return log(2)*k+C(n,k);
}
void get(){
	scanf("%d%d",&n,&k);
	printf("%.10lf\n",log(3ll*k+1)+log(3)*n-calc(n,k));
}
int main(){
	for(scanf("%d",&T);T--;)get();
	return 0;
}
#ifdef DEBUG
#include"debug.hpp"
#endif

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
100 0
100 1

output:

109.8612288668
105.9542226119

result:

ok q=0 (2 test cases)

Test #2:

score: 0
Accepted
time: 4ms
memory: 4036kb

input:

10000
32 6
45 98
67 57
35 70
29 3
22 81
59 12
48 16
63 69
99 36
60 36
32 47
73 91
81 30
7 7
71 57
38 60
35 19
92 40
3 17
21 71
54 62
95 67
60 50
10 20
19 80
64 73
10 21
70 97
84 3
26 22
38 47
37 38
31 91
11 37
73 17
75 98
8 74
73 60
87 10
94 48
35 73
18 14
88 25
61 54
39 59
100 90
70 98
73 21
92 11
...

output:

19.4986670475
6.6869753563
6.1623472325
6.3589676957
23.4376677076
6.5419790223
31.3123846647
15.9821751871
6.3375380797
24.6079703440
6.2740866816
5.9635998066
6.6267654537
20.3126866622
4.2283830189
6.1510074247
6.2050476858
6.2106546912
16.1575363229
4.9512437186
6.3659760150
6.2311086169
6.31089...

result:

ok q=0 (10000 test cases)

Test #3:

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

input:

1
10000 0

output:

10986.1228866811

result:

ok q=0 (1 test case)

Test #4:

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

input:

1
10000 10

output:

10904.5528509577

result:

ok q=0 (1 test case)

Test #5:

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

input:

1
10000 100

output:

10363.4999353414

result:

ok q=0 (1 test case)

Test #6:

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

input:

1
100000 0

output:

109861.2288668110

result:

ok q=0 (1 test case)

Test #7:

score: 0
Accepted
time: 1ms
memory: 4124kb

input:

1000
867 38
906 28
876 34
182 38
692 59
986 55
675 20
699 12
741 82
154 11
264 6
682 4
176 19
728 69
37 95
501 56
998 96
495 52
359 86
750 19
726 39
794 6
268 16
609 70
414 45
182 19
123 68
909 56
880 71
419 8
679 14
363 16
751 35
299 73
852 35
901 36
903 63
425 85
416 33
80 89
863 91
491 32
603 84
...

output:

775.9041833504
856.4630879557
800.6544238912
86.1049479653
523.8548087759
839.0361561789
642.7308835772
703.5498112577
505.9523496022
126.4609633496
261.1827665987
725.5027535257
125.0161583026
530.1011237386
6.6827849656
342.2615068279
720.5373151637
347.4856643317
143.6949122614
727.2555378645
624...

result:

ok q=0 (1000 test cases)

Test #8:

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

input:

1000
71 766
31 464
8 194
12 296
69 506
55 518
31 237
73 576
50 685
1 137
29 661
58 508
46 870
33 172
66 94
41 634
38 725
94 163
94 45
34 685
71 486
95 511
37 108
54 643
64 94
1 624
48 283
1 64
23 122
3 866
52 798
68 669
43 460
68 187
50 403
31 877
100 191
44 512
33 50
91 732
37 584
22 501
46 93
81 7...

output:

8.7437424727
8.2711424441
7.3988436876
7.7900972355
8.3258075026
8.3673054020
7.6000053817
8.4689358330
8.6335012074
7.1196356380
8.6014426931
8.3468944995
8.8890751978
7.2480428745
6.6454468976
8.5572600894
8.6917942625
7.2050065602
12.9198840090
8.6576534034
8.2890194964
8.3382609803
6.8106183371
...

result:

ok q=0 (1000 test cases)

Test #9:

score: 0
Accepted
time: 48ms
memory: 4132kb

input:

100000
448906 73251
858780 829062
380117 529011
219451 974416
390411 446812
457769 678634
440286 29979
663948 267273
623318 824172
557346 329036
2366 757990
279231 95725
394222 75586
671713 417299
997686 156089
462641 704003
267172 15563
115033 76151
271539 36507
909436 341831
97232 987703
780566 75...

output:

242694.8414425428
15.7266629100
15.2773780806
15.8882107837
15.1085062383
15.5264505592
353450.3816252095
96653.9688728172
15.7207476193
7080.8090649057
15.6371438565
60914.9590725858
188050.7517171232
3069.0010060295
555157.4425323715
15.5631511994
223396.5380747811
18.9804107752
165834.0679556715
...

result:

ok q=0 (100000 test cases)

Test #10:

score: 0
Accepted
time: 56ms
memory: 4088kb

input:

100000
740599 913
947030 8115
575926 9039
721122 7094
794424 8453
157723 6263
973352 1890
462079 302
333631 3870
435636 4238
572643 7448
775859 6119
343386 2778
486927 1883
880553 7918
878758 5150
274829 778
759586 5734
461205 6806
744940 1346
378522 4830
214767 1511
367452 9987
288068 9685
761467 1...

output:

805979.0866425572
988100.5860437318
579945.6394097178
747482.9394319318
820105.2789160373
142603.5421983445
1054346.4201599315
504927.6607712599
342763.7864009985
451817.1886300367
584220.1614086165
812411.1762793714
359183.8418828659
521308.5428221995
916721.8335910529
930251.9043964607
296058.4418...

result:

ok q=0 (100000 test cases)

Test #11:

score: 0
Accepted
time: 47ms
memory: 4040kb

input:

100000
3460 249080
4870 627106
7714 639325
6245 973410
5156 799724
2143 932101
3190 88015
5691 880401
4405 773261
157 516968
1022 535321
7679 193074
2293 754309
6302 607322
9422 65236
7327 352879
2188 417324
3181 532778
8804 165866
2433 321295
4829 557456
7228 613548
470 947610
2867 326654
1091 7711...

output:

14.5244320254
15.4476890093
15.4669106501
15.8872133117
15.6906831382
15.8442756662
13.4841920563
15.7867454318
15.6572116334
15.2607052214
15.2894793358
14.2694753848
15.6326061545
15.4154669136
13.1844106743
14.8726302095
15.0406882337
15.2847873540
14.1175782064
14.7787283093
15.3298035108
15.425...

result:

ok q=0 (100000 test cases)

Test #12:

score: 0
Accepted
time: 55ms
memory: 4032kb

input:

100000
485911443 648621499
967545108 273118575
544774196 541753568
572826636 56596285
997351031 75012282
841305005 238445153
871651103 680174033
831928615 349267999
895576242 735170120
38669405 423897783
879163052 156607422
474161410 146955978
703868457 884260985
882781563 482183053
774752914 414027...

output:

22.3889722824
297865538.2665129900
22.2089335918
405381373.4513075948
777499086.8381696939
257440431.5209509134
22.4364715815
105964401.0369997025
22.5142275095
21.9636152536
445375772.4571757317
125531064.0115738511
22.6988730431
27488628.5314886570
28988558.8559976816
22.1228002310
21.9327564836
2...

result:

ok q=0 (100000 test cases)

Test #13:

score: 0
Accepted
time: 64ms
memory: 4052kb

input:

100000
998709247 6662353
938409567 5496364
470262254 388552
44631553 8053900
263812189 8140673
570847244 3686835
143527865 6364614
630983298 5151426
508843717 9845212
529080317 4866307
229185417 7424168
870671276 2477533
922155225 4868463
286532330 7131107
5469824 6272182
112064124 9288326
871839242...

output:

1052557868.5628446341
993406415.4288468361
513220008.4199798107
22380598.8894377574
247854658.5224891007
602319067.0597361326
127217806.6446906924
659736899.9670209885
503607555.5434994698
550220065.5650136471
213873949.7807152867
937815578.9327381849
979331024.4859906435
276465503.7357553244
17.750...

result:

ok q=0 (100000 test cases)

Test #14:

score: 0
Accepted
time: 50ms
memory: 4144kb

input:

100000
2388237 863104141
1949853 594471487
5788570 323905636
6626472 532884672
6478027 985480511
8713369 400770447
7877963 563355387
8572690 802705946
246447 691673591
1048191 39348128
9822372 87353076
4622806 985586908
3940664 689517333
7206000 907183324
7647553 126209541
9304319 816108273
3026286 ...

output:

22.6746582058
22.3017956032
21.6945752315
22.1924278876
22.8072523493
21.9075117689
22.2480335385
22.6021114197
22.4532370025
19.5865712566
20.3840810861
22.8073603753
22.4501147438
22.7244674079
20.7520665433
22.6186699122
22.2367298868
21.8567963141
22.4600164611
22.2233530469
21.9539225507
22.317...

result:

ok q=0 (100000 test cases)

Test #15:

score: 0
Accepted
time: 46ms
memory: 4136kb

input:

100000
3230 990083111
447677 391972657
692146 408354973
191509 902573102
662501 450354073
721550 41375394
457751 109724688
636199 701346721
4329 135209393
7190 728002830
562092 480808431
608393 78791345
751611 613615532
576135 459945713
830181 180428675
549685 436319534
608642 828570290
40757 416064...

output:

22.8119891325
21.8853154909
21.9262611208
22.7193777550
22.0241573270
19.6368095578
20.6120977880
22.4671267930
20.8209474851
22.5044625523
22.0895917660
20.2809264179
22.3334914113
22.0452313141
21.1094583962
21.9924995180
22.6338249309
21.9449703760
21.8324908363
21.8845400285
22.5258320155
19.952...

result:

ok q=0 (100000 test cases)

Test #16:

score: 0
Accepted
time: 46ms
memory: 4148kb

input:

100000
25834 61214455
26648 808954129
93315 645258548
40846 889138139
50931 688595112
83574 231579050
4476 298005500
10230 178645104
67274 582026639
45478 228216795
31799 640547396
76931 331956048
42831 764190687
32200 938076217
11303 774768820
48548 908303551
52646 376587760
30951 91507236
32097 76...

output:

20.0285449147
22.6098744431
22.3837739333
22.7043999394
22.4487762995
21.3590441321
21.6112347905
21.0995240271
22.2806427816
21.3444408690
22.3764538260
21.7191286719
22.5529401955
22.7579851031
22.5667096528
22.7257066265
21.8452787106
20.4305409014
22.5479007997
22.4986984372
21.8226589781
21.181...

result:

ok q=0 (100000 test cases)

Test #17:

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

input:

100000
274227737 68346059
218685007 54356465
989024364 38654736
621112634 30460344
744276614 23921662
244777456 92571767
802238000 396401
867445410 73326922
915786289 8870270
283682509 84172313
874633287 75201041
511367562 84949073
634359016 56041772
732833967 55417420
693037815 93779223
439536157 2...

output:

99920312.5178580582
79945798.9150264263
896551031.7145178318
539706995.1059617996
695323392.4185571671
42420658.4885148406
877659777.4609080553
650860081.9406018257
949986382.2273209095
80819158.2718109488
652369964.8650002480
272959456.7458930016
468593083.5769343376
570331661.3127639294
421678367....

result:

ok q=0 (100000 test cases)

Test #18:

score: 0
Accepted
time: 59ms
memory: 4152kb

input:

100000
145675394 9644
868401983 5079
81959359 7252
221259510 4525
210940342 503
709938567 8322
313226886 2026
284975389 1034
961263243 1271
708878403 8424
147154537 1117
597142707 9049
49009960 8469
632841549 912
998250617 5932
107131683 9999
243110679 3650
921083825 3103
645636937 7805
803218474 41...

output:

159931658.6010158956
953967302.8070285320
89961610.8227521479
243021907.1723180711
231734296.4771282971
779838666.4619854689
344087277.6003411412
313062770.0192717910
1056036264.1522955894
778672741.6765197515
161650732.7002803683
655912586.9075793028
53755246.8843458891
695233700.7935427427
1096608...

result:

ok q=0 (100000 test cases)

Test #19:

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

input:

100000
415903859 143863
726725861 220923
721402153 142794
636365369 56467
195687608 492519
244711303 612418
892437244 320712
965738323 66085
653139241 592706
2885567 920921
430945805 947767
493265196 74615
877041778 105313
477250612 324587
932782139 573227
651591411 492931
438774413 597150
816745072...

output:

455527053.7249460220
796226811.4307137728
791081844.3680573702
698496393.2010533810
211203940.2183684111
264138072.5704949796
977355962.1793550253
1060226377.3653010130
712391727.3649631739
724787.0161835044
466038724.5735968351
541124542.7703812122
962399884.8266369104
521396646.7448273301
10195567...

result:

ok q=0 (100000 test cases)

Test #20:

score: 0
Accepted
time: 64ms
memory: 4092kb

input:

100000
932735028 38475
303723723 37217
293643065 82693
53306635 90174
883367937 63149
414476477 62827
308746443 66010
319864936 52981
95584375 56035
201651629 95614
453621071 58910
638222297 35431
980668234 47930
725614760 41170
688105374 50896
958291243 76312
808245100 31656
617265859 68228
8643946...

output:

1024260594.9321005344
333276397.9499306679
321783879.2790784836
57835239.0189534500
969769145.5030032396
454690068.6209294200
338523076.4850032330
350856624.3460218906
104498322.3389098346
220643277.8962815702
497726770.6263056397
700751698.8219574690
1076817269.4211857319
796697077.4445762634
75539...

result:

ok q=0 (100000 test cases)

Test #21:

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

input:

1
1000 1000000000

output:

22.8228777931

result:

ok q=0 (1 test case)

Test #22:

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

input:

1
1 100000000

output:

20.6179053246

result:

ok q=0 (1 test case)

Test #23:

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

input:

1
100 1000000000

output:

22.8318452877

result:

ok q=0 (1 test case)

Test #24:

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

input:

1
1 1000000000

output:

22.9204904146

result:

ok q=0 (1 test case)

Test #25:

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

input:

1
1000000000 1000000000

output:

22.8218781948

result:

ok q=0 (1 test case)

Extra Test:

score: 0
Extra Test Passed