QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#578041#6423. Fireworkslibantian#WA 0ms4008kbC++23988b2024-09-20 16:09:382024-09-20 16:09:38

Judging History

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

  • [2024-09-20 16:09:38]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4008kb
  • [2024-09-20 16:09:38]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define fi first
#define se second
#define all(_a) _a.begin(),_a.end()
double qmi(double a,int b){
    double res=1;
    while(b){
        if(b&1)res=res*a;
        a=a*a;
        b>>=1;
    }
    return res;
}
int n,m;
double p;
double f(int x){
    return (n*x+m)*1.0/(1-qmi(1-p,x));
}
void solve(){
    cin>>n>>m>>p;
    p*=1e-4;
    int l=1,r=10000;
    while(l+2<r){
        int m1=l+(r-l)/3;
        int m2=l+(r-l)/3*2;
        if(f(m1)>f(m2))l=m1;
        else r=m2;
    }
    double res=1e18;
   if(l-2>0)res=min(res,f(l-2));
   if(l-1>0)res=min(res,f(l-1));
   if(l>0)res=min(res,f(l));
   if(l+1>0)res=min(res,f(l+1));
   if(l+2>0)res=min(res,f(l+2));
   printf("%.14lf\n",res);

}
signed main(){
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr),cin.tie(nullptr);
    int T=1;
    cin>>T;
    while(T--)solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 1 5000
1 1 1
1 2 10000

output:

4.00000000000000
10141.58528911614303
3.00000000000000

result:

ok 3 numbers

Test #2:

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

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.72980565054797
200.34843205574910
177.34627831715210
416.83987780035460
90.29345372460496
149.56942136274361
190.67250708580264
164.60152111557690
139.34970139349701
275.13311024842301
167.36401673640165
207.19073735527118
300.73221757322170
589.05884895051952
101.87702821244885
10796.88726690459...

result:

ok 20 numbers

Test #3:

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

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.02916574478149
1951513567.02302622795105
2010693554.59459447860718
2021655257.39094471931458
2031572260.12113475799561
2023744964.09816741943359
2057899480.77130246162415
1934924193.05256676673889
1909560538.20664715766907
1938062078.64038610458374

result:

ok 10 numbers

Test #4:

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

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.66504693031311
1035512471.34974527359009
940905431.72898161411285
1063626543.68516731262207
1001518880.76606249809265
1045380761.46587657928467
1009160282.76007592678070
1022500825.10812902450562
960922565.45031833648682
1033287652.53692996501923

result:

ok 10 numbers

Test #5:

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

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.17724990844727
18075237355.67971038818359
102118356741.57281494140625
20399770568.92780685424805
84356173628.31875610351562
282304390588.23870849609375
80421952434.78292846679688
24940588507.85339736938477
458817209499.99957275390625
14331610061.16207695007324

result:

ok 10 numbers

Test #6:

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

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.29486083984375
31076848077.76112365722656
40771434362.89513397216797
16579259543.36352729797363
33660076568.70192337036133
20209258011.50192260742188
34581380127.39511108398438
24798113234.33294296264648
33145494087.72825241088867
26925682159.12006378173828

result:

ok 10 numbers

Test #7:

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

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.68129336833954
973616306.98693597316742
987457697.39677941799164
967376069.31548535823822
948133283.10161387920380
962822722.64757907390594
933426898.31772816181183
950377057.36334311962128
991923706.58539175987244
957678776.96534550189972

result:

ok 10 numbers

Test #8:

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

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.90179026126862
949941549.32047283649445
921813131.82122611999512
927065583.85839009284973
923767096.49396598339081
941829231.44262266159058
917540568.64706635475159
952051875.05521523952484
958387391.92101383209229
950375326.49561893939972

result:

ok 10 numbers

Test #9:

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

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.14261405934275
194.59683262602215
150.26455026455025
48.47570828395992
152.22984562607203
73.22851604566013
87.73762272822226
101.91082802547770
124.71085185557678
33.12673648215431

result:

ok 10 numbers

Test #10:

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

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.28383823870900
795.19595967869589
1340.26261031728131
3590.64750473240611
734.46310782457078
1204.04404179892640
568.43253704695860
761.45344976166007
1986.66955837413616
1378.15844833914730

result:

ok 10 numbers

Test #11:

score: -100
Wrong Answer
time: 0ms
memory: 3944kb

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:

1018693090.36026251316071
1006805302.48914217948914
1156539263.66517400741577
1018662530.07687282562256
1581978103.63864183425903
1581978105.22057247161865
1052402441.69013464450836
1581978089.40126585960388
1581962308.06087589263916
1156492982.43444299697876
1018682874.39805746078491
1581978117.876...

result:

wrong answer 1st numbers differ - expected: '1000153595.96685', found: '1018693090.36026', error = '0.01854'