QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#642471#6423. FireworksSSAABBEERRAC ✓51ms4024kbC++20920b2024-10-15 14:28:192024-10-15 14:28:21

Judging History

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

  • [2024-10-15 14:28:21]
  • 评测
  • 测评结果:AC
  • 用时:51ms
  • 内存:4024kb
  • [2024-10-15 14:28:19]
  • 提交

answer

#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define pii pair<int, int>
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);  
#define rep(x,a,b) for(int x=a;x<=b;x++)
#define pre(x,a,b) for(int x=a;x>=b;x--)
using namespace std;
const int N = 1e6 + 10;
double n, m, p;
double qmi(double x, int b)
{
	double base = 1;
	while(b)
	{
		if(b & 1) base = base * x;
		b >>= 1;
		x = x * x;
	}
	return base;
}
double check(int x)
{
    return (n * x + m) / (1 - qmi(1 - p, x));
}
void solve()
{   
    cin >> n >> m >> p;
    p = p * 0.0001;
    int l = 1, r = 1e9;
	while(l <= r)
	{
		double ml = l + (r - l) / 3, mr = r - (r - l) / 3;
		if(check(ml) <= check(mr)) r = mr - 1;
		else l = ml + 1;
	}
    printf("%.7lf\n", min(check(l), check(r)));
}
signed main()
{
    IOS;
	int _;
	_ = 1;
	cin >> _;
	while(_--)
	{
	    solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 1 5000
1 1 1
1 2 10000

output:

4.0000000
10141.5852891
3.0000000

result:

ok 3 numbers

Test #2:

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

input:

20
10 27 2855
79 59 6888
65 72 7725
78 50 2888
31 21 5759
41 58 6619
47 27 3881
35 55 5095
77 7 6028
17 89 1792
84 60 8604
58 44 4923
88 27 3824
54 63 1482
19 42 5366
93 76 97
100 99 8660
96 36 4343
90 56 9515
24 44 9922

output:

89.7298057
200.3484321
177.3462783
416.8398778
90.2934537
149.5694214
190.6725071
164.6015211
139.3497014
275.1331102
167.3640167
207.1907374
300.7322176
589.0588490
101.8770282
10796.8872669
229.7921478
303.9373705
153.4419338
68.5345696

result:

ok 20 numbers

Test #3:

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

input:

10
954269343 987322500 9806
916720797 981711601 9728
902477101 957414437 9250
967013471 988735825 9674
985383693 926528961 9411
970653208 917703218 9331
998423148 911924940 9283
986159007 902133513 9759
953796828 947934512 9959
995334734 931874197 9944

output:

1980003919.0291657
1951513567.0230262
2010693554.5945945
2021655257.3909447
2031572260.1211348
2023744964.0981674
2057899480.7713025
1934924193.0525668
1909560538.2066472
1938062078.6403861

result:

ok 10 numbers

Test #4:

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

input:

10
933722894 72 9673
975866948 5 9424
910984544 95 9682
994597175 6 9351
972675086 51 9712
952759975 51 9114
956482031 85 9478
921988922 72 9017
950640658 36 9893
965297247 78 9342

output:

965287879.6650469
1035512471.3497453
940905431.7289816
1063626543.6851673
1001518880.7660625
1045380761.4658766
1009160282.7600759
1022500825.1081290
960922565.4503183
1033287652.5369300

result:

ok 10 numbers

Test #5:

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

input:

10
910088095 81 316
970640211 35 537
908853334 41 89
932269507 8 457
953224740 22 113
959834859 69 34
924852390 63 115
952730384 97 382
917634328 91 20
937287266 32 654

output:

28800258734.1772499
18075237355.6797104
102118356741.5728149
20399770568.9278069
84356173628.3187561
282304390588.2387085
80421952434.7829285
24940588507.8533974
458817209499.9995728
14331610061.1620770

result:

ok 10 numbers

Test #6:

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

input:

10
968675373 962412132 104
923494255 934310785 381
922721350 957856460 282
978335370 917228676 825
951116860 942542480 359
999013758 972493824 676
930242700 964474169 342
968944030 984608304 520
965837594 909045242 369
990484700 925952624 479

output:

106669104052.2948608
31076848077.7611237
40771434362.8951340
16579259543.3635273
33660076568.7019234
20209258011.5019226
34581380127.3951111
24798113234.3329430
33145494087.7282524
26925682159.1200638

result:

ok 10 numbers

Test #7:

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

input:

10
22 972733171 975
22 973609752 512
55 987399854 126
49 967364929 642
23 948126474 513
25 962813818 421
93 933323422 113
58 950364131 647
82 991906690 682
31 957667404 402

output:

972736672.6812934
973616306.9869360
987457697.3967794
967376069.3154854
948133283.1016139
962822722.6475791
933426898.3177282
950377057.3633431
991923706.5853918
957678776.9653455

result:

ok 10 numbers

Test #8:

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

input:

10
47 972371220 9743
65 949941115 9400
86 921812690 9736
11 927065494 9182
71 923766617 9378
63 941828720 9029
96 917539847 9084
88 952051332 9499
91 958386812 9427
64 950375055 9887

output:

972371465.9017903
949941549.3204728
921813131.8212261
927065583.8583901
923767096.4939660
941829231.4426227
917540568.6470664
952051875.0552152
958387391.9210138
950375326.4956189

result:

ok 10 numbers

Test #9:

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

input:

10
98 46 9403
99 89 9661
80 62 9450
25 20 9283
68 74 9328
54 14 9286
4 80 9574
35 61 9420
77 47 9943
22 9 9358

output:

153.1426141
194.5968326
150.2645503
48.4757083
152.2298456
73.2285160
87.7376227
101.9108280
124.7108519
33.1267365

result:

ok 10 numbers

Test #10:

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

input:

10
89 77 65
53 41 913
47 67 488
89 13 267
20 60 427
58 72 690
23 60 677
43 38 775
52 68 343
83 61 805

output:

15149.2838382
795.1959597
1340.2626103
3590.6475047
734.4631078
1204.0440418
568.4325370
761.4534498
1986.6695584
1378.1584483

result:

ok 10 numbers

Test #11:

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

input:

20
5 1000000000 4
3 999999979 5
5 1000000000 2
2 999999999 4
3 999999983 1
3 999999984 1
3 999999987 3
3 999999974 1
2 999999998 1
1 999999981 2
4 999999971 4
3 999999992 1
5 999999973 4
4 999999984 4
3 999999972 4
2 999999994 4
2 999999980 5
4 999999970 5
2 999999980 2
4 999999983 4

output:

1000153595.9668460
1000078103.9377191
1000289896.6213884
1000066017.4862779
1000342407.0434644
1000342408.0434945
1000125100.2351018
1000342398.0431945
1000236387.4726646
1000066005.5899478
1000125078.4776289
1000342416.0437343
1000153568.9665086
1000125091.4777589
1000095959.5738842
1000066012.4862...

result:

ok 20 numbers

Test #12:

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

input:

10000
15 999999991 6
16 999999975 2
12 999999978 9
7 999999993 4
19 999999980 5
20 999999977 5
13 999999995 10
11 999999979 6
19 999999995 5
6 999999982 10
15 999999978 1
2 999999974 5
12 999999980 4
18 999999997 1
12 999999992 10
20 999999970 6
2 999999999 2
13 999999984 1
16 999999984 2
16 9999999...

output:

1000289834.6274338
1000834644.9803736
1000162916.0544204
1000209141.2387604
1000424660.5573018
1000444958.7589437
1000159181.2223668
1000218214.1490877
1000424675.5578715
1000078088.8970948
1001470863.7083153
1000053678.6490806
1000342357.1715584
1001732290.5897384
1000147893.0251669
1000376844.5438...

result:

ok 10000 numbers

Test #13:

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

input:

50
3 999999983 9
8 999999973 7
6 999999988 9
17 999999995 10
19 999999993 6
13 999999989 6
17 999999995 1
8 999999999 7
9 999999971 3
15 999999986 8
2 1000000000 8
9 999999975 4
8 999999980 2
4 999999970 9
2 999999990 10
8 999999983 3
15 999999985 5
16 999999991 7
20 999999986 5
15 999999990 6
15 99...

output:

1000045336.0230830
1000141407.8814532
1000086075.4163908
1000203604.1466587
1000359647.0716624
1000254285.6284746
1001645751.8154860
1000141433.8817502
1000342363.7958627
1000222739.4700012
1000034735.2352377
1000263227.6511914
1000445022.5312680
1000059162.7476439
1000028221.6584759
1000307471.6316...

result:

ok 50 numbers