QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#439420#8785. Fake Coin and Lying Scalesucup-team1004AC ✓84ms19800kbC++14463b2024-06-11 21:35:522024-06-11 21:35:53

Judging History

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

  • [2024-06-11 21:35:53]
  • 评测
  • 测评结果:AC
  • 用时:84ms
  • 内存:19800kb
  • [2024-06-11 21:35:52]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
const int M=1e6;
ld s[M+10];
ld qry(int x)
{
	if(x<=M) return s[x];
	else return (x+0.5)*log(x)-x+0.92;
}
ld calc(int n,int k)
{
	k=min(k,n*2/3);
	return qry(n)-qry(k)-qry(n-k)+log(2)*k;
}
int T,n,k;
int main()
{
	for(int i=2;i<=M;i++) s[i]=s[i-1]+log(i);
	scanf("%d",&T);
	while(T--)
	{
		scanf("%d%d",&n,&k);
		printf("%.10Lf\n",n*log(3)+log(3ll*k+1)-calc(n,k));
	}
}

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

詳細信息

Test #1:

score: 100
Accepted
time: 14ms
memory: 19752kb

input:

2
100 0
100 1

output:

109.8612288668
105.9492058614

result:

ok q=0 (2 test cases)

Test #2:

score: 0
Accepted
time: 13ms
memory: 19752kb

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:

20.2241426501
7.7636870232
7.4430544761
7.3186175437
23.8793221858
7.2872207818
32.3673850489
17.0907511792
7.5806345812
26.0954715321
7.5310372187
6.8798167915
7.9494403805
21.7042949648
4.4533916903
7.4567780786
7.2046549482
7.2176453729
17.6384221947
4.7621739348
7.0690171945
7.3979011918
7.76037...

result:

ok q=0 (10000 test cases)

Test #3:

score: 0
Accepted
time: 9ms
memory: 19684kb

input:

1
10000 0

output:

10986.1228866811

result:

ok q=0 (1 test case)

Test #4:

score: 0
Accepted
time: 10ms
memory: 19676kb

input:

1
10000 10

output:

10905.6309123590

result:

ok q=0 (1 test case)

Test #5:

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

input:

1
10000 100

output:

10365.7172672144

result:

ok q=0 (1 test case)

Test #6:

score: 0
Accepted
time: 9ms
memory: 19756kb

input:

1
100000 0

output:

109861.2288668110

result:

ok q=0 (1 test case)

Test #7:

score: 0
Accepted
time: 7ms
memory: 19676kb

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:

777.6217028903
858.0354113851
802.3192043994
87.7278966442
525.7693819045
840.9315828938
644.1368196089
704.7094898133
508.0170394623
127.5494108335
261.9999735771
726.1326894475
126.3546400913
532.0885464737
7.6753949545
344.1353643084
722.6887353539
349.3263530334
145.7051412579
728.6382544621
626...

result:

ok q=0 (1000 test cases)

Test #8:

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

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:

10.0495131265
9.1789530646
7.6659979022
8.2237094925
9.6139873946
9.5517414821
8.5078160022
9.7916107598
9.7670486174
7.1196356380
9.4700880217
9.5571932282
9.9867598499
8.1720326084
7.9115930117
9.5938648559
9.6914015250
8.6517944810
14.4190825016
9.6096657743
9.5947901503
9.7877460147
7.8032283261...

result:

ok q=0 (1000 test cases)

Test #9:

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

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:

242700.2721346681
21.7251971137
20.8683965304
21.2045563520
20.7128844747
21.2104115619
353455.4194333167
96659.8782814272
21.5590543736
7086.6337241923
18.6887505620
60920.4027335182
188056.1807375798
3074.9052899489
555163.2554936129
21.2524055318
223401.2533363034
23.9772447541
165839.1673341357
...

result:

ok q=0 (100000 test cases)

Test #10:

score: 0
Accepted
time: 70ms
memory: 19680kb

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:

805982.4134235321
988105.0014243661
579950.1050997907
747487.2869414529
820109.7136540596
142607.8120981136
1054350.1103367960
504930.4348723511
342767.8300322398
451821.2786236372
584224.5316629083
812415.4508495032
359187.7215331990
521312.2301784497
916726.2364707004
930256.0937882810
296061.6878...

result:

ok q=0 (100000 test cases)

Test #11:

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

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:

17.7660724640
18.8601759436
19.1093091543
19.4239680810
19.1316461919
18.8465255650
16.6852280007
19.2770171464
19.0195388737
16.9607050614
17.9216670842
17.9095680545
18.6686590755
18.9567638485
16.9267693226
18.4892987790
18.0533211331
18.4844113477
17.8260202812
17.8441881950
18.7380128367
19.035...

result:

ok q=0 (100000 test cases)

Test #12:

score: 0
Accepted
time: 71ms
memory: 19732kb

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:

31.5577015579
297865547.7333833277
31.4348376095
405381382.2450191230
777499095.7856544405
257440440.9191414416
31.8973833323
105964410.5204572678
31.9886795282
29.8668562323
445375781.7137208283
125531073.1489172876
32.0528865457
27488638.0533506870
28988568.3145052195
31.4997953176
30.9569366276
3...

result:

ok q=0 (100000 test cases)

Test #13:

score: 0
Accepted
time: 67ms
memory: 19800kb

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:

1052557876.3354934985
993406423.1057088342
513220014.7735962462
22380606.6607694542
247854666.3830081848
602319074.5366352536
127217814.3751443597
659736907.6103118523
503607563.5049791485
550220073.1793169291
213873957.5943761338
937815586.2127006017
979331032.1024861932
276465511.5331426756
24.675...

result:

ok q=0 (100000 test cases)

Test #14:

score: 0
Accepted
time: 67ms
memory: 19736kb

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:

29.1845911436
28.7103278363
28.6482345387
29.2136807283
29.8171770032
29.0656576590
29.3557848400
29.7521188688
27.8275891401
25.6836981718
27.6021290254
29.6485780012
29.2115060110
29.7876409888
27.8449760508
29.8096259004
28.8661145368
27.0592951342
29.3648127927
29.3768456685
28.5015546610
29.280...

result:

ok q=0 (100000 test cases)

Test #15:

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

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:

26.0191753261
27.5581301701
27.8169381965
27.9676267656
27.8929466526
25.5482886206
26.2960391296
28.3156612154
24.1744606187
26.1116609390
27.8762025279
26.1071153097
28.2653787238
27.8441802993
27.0910580963
27.7679511258
28.4602184185
26.4195749422
27.8417589689
27.9195060761
27.9647841883
25.262...

result:

ok q=0 (100000 test cases)

Test #16:

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

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:

24.2751987578
26.8720292939
27.2725449665
27.1801012431
27.0347953883
26.1926913297
24.9814423223
24.8829923023
27.0058152234
25.8738500965
26.7269657553
26.5113676452
27.0523555492
27.1147703880
26.4000691342
27.2877717576
26.4478616047
24.7675304536
26.9030686450
27.2848201031
26.4705325486
25.521...

result:

ok q=0 (100000 test cases)

Test #17:

score: 0
Accepted
time: 71ms
memory: 19728kb

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:

99920321.3145766556
79945807.5976809114
896551040.3496762663
539707003.6167870238
695323400.8173724320
42420667.3427042365
877659783.8246888522
650860090.8716614768
949986390.1415605498
80819167.1400043443
652369973.8078851700
272959465.7038414702
468593092.3714925945
570331670.1086491570
421678376....

result:

ok q=0 (100000 test cases)

Test #18:

score: 0
Accepted
time: 72ms
memory: 19732kb

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:

159931663.1069754851
953967306.9924155950
89961615.1861744077
243021911.2999514130
231734299.5065259481
779838670.8942577572
344087281.3262268490
313062773.4088845087
1056036267.6450767380
778672746.1148818694
161650736.1284901156
655912591.3817242693
53755251.3252917258
695233704.1203912852
1096608...

result:

ok q=0 (100000 test cases)

Test #19:

score: 0
Accepted
time: 84ms
memory: 19692kb

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:

455527059.5820210318
796226817.5022873917
791081850.2214792278
698496398.5906549162
211203946.6896911460
264138079.1507658468
977355968.4372629341
1060226382.8335543935
712391733.9296732155
724793.6094822190
466038731.3723667053
541124548.2992929412
962399890.5278623964
521396653.0085814355
10195567...

result:

ok q=0 (100000 test cases)

Test #20:

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

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:

1024260600.1299002371
333276403.1310718993
321783884.8593221000
57835244.6417945875
969769150.9485300877
454690074.0638631293
338523081.9526169198
350856629.7037236232
104498327.7244226647
220643283.5490211159
497726776.0370642596
700751703.9785405064
1076817274.7288518138
796697082.6762223812
75539...

result:

ok q=0 (100000 test cases)

Test #21:

score: 0
Accepted
time: 7ms
memory: 19676kb

input:

1
1000 1000000000

output:

25.4444453113

result:

ok q=0 (1 test case)

Test #22:

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

input:

1
1 100000000

output:

20.6179053246

result:

ok q=0 (1 test case)

Test #23:

score: 0
Accepted
time: 11ms
memory: 19800kb

input:

1
100 1000000000

output:

24.3090865570

result:

ok q=0 (1 test case)

Test #24:

score: 0
Accepted
time: 9ms
memory: 19684kb

input:

1
1 1000000000

output:

22.9204904146

result:

ok q=0 (1 test case)

Test #25:

score: 0
Accepted
time: 7ms
memory: 19668kb

input:

1
1000000000 1000000000

output:

32.3514734507

result:

ok q=0 (1 test case)

Extra Test:

score: 0
Extra Test Passed