QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#203540 | #6423. Fireworks | qzzyq | WA | 0ms | 4216kb | C++14 | 1.5kb | 2023-10-06 17:59:40 | 2023-10-06 17:59:40 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define maxn
#define put() putchar('\n')
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
using namespace std;
void read(int &x){
int f=1;x=0;char c=getchar();
while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
while (c>='0'&&c<='9') {x=x*10+c-'0';c=getchar();}
x*=f;
}
namespace Debug{
Tp void _debug(char* f,Ty t){cerr<<f<<'='<<t<<endl;}
Ts void _debug(char* f,Ty x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
Tp ostream& operator<<(ostream& os,vector<Ty>& V){os<<"[";for(auto& vv:V) os<<vv<<",";os<<"]";return os;}
#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
}using namespace Debug;
#define fi first
#define se second
#define mk make_pair
const int mod=1e9+7;
int power(int x,int y=mod-2) {
int sum=1;
while (y) {
if (y&1) sum=sum*x%mod;
x=x*x%mod;y>>=1;
}
return sum;
}
double n,m,p;
double pw(double x,int y) {
double sum=1;
while (y) {
if (y&1) sum=sum*x;
x=x*x;y>>=1;
}
return sum;
}
void solve(void) {
scanf("%lf%lf%lf",&n,&m,&p);
p=p/10000;
double ans=1e15,res=(1-p);
int i;
double sh=log2(n/m)/log2(1-p);
for (i=1;i<=100;i++) {
ans=min(ans,(n*i+m)/(1-res));
res=res*(1-p);
}
int l=max(sh-100,1.0);
res=pw(1-p,l);
for (i=l;i<=l+300;i++) {
ans=min(ans,(n*i+m)/(1-res));
res=res*(1-p);
}
printf("%.9lf\n",ans);
}
// 1000153595.96685
signed main(void){
int T;
read(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: 4216kb
input:
3 1 1 5000 1 1 1 1 2 10000
output:
4.000000000 10141.585289115 3.000000000
result:
ok 3 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 4020kb
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.729805651 200.348432056 177.346278317 416.839877800 90.293453725 149.569421363 190.672507086 164.601521116 139.349701393 275.133110248 167.364016736 207.190737355 300.732217573 589.058848951 101.877028212 10796.887266905 229.792147806 303.937370481 153.441933789 68.534569643
result:
ok 20 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 4100kb
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.029165745 1951513567.023026228 2010693554.594594479 2021655257.390944719 2031572260.121134758 2023744964.098167419 2057899480.771302462 1934924193.052566767 1909560538.206647158 1938062078.640386105
result:
ok 10 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 4028kb
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.665046930 1035512471.349745274 940905431.728981614 1063626543.685167313 1001518880.766062498 1045380761.465876579 1009160282.760075927 1022500825.108129025 960922565.450318336 1033287652.536929965
result:
ok 10 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3976kb
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.177249908 18075237355.679710388 102118356741.572814941 20399770568.927806854 84356173628.318756104 282304390588.238708496 80421952434.782928467 24940588507.853397369 458817209499.999572754 14331610061.162076950
result:
ok 10 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 4036kb
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.294677734 31076848077.761112213 40771434362.895133972 16579259543.363527298 33660076568.701923370 20209258011.501922607 34581380127.395095825 24798113234.332942963 33145494087.728252411 26925682159.120063782
result:
ok 10 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 3912kb
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.681293368 973616306.986935973 987466985.179278851 967376069.315485358 948133283.101613879 962822722.647579074 933446287.840358853 950377057.363343120 991923706.585391760 957678776.965345502
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.901790261 949941549.320472836 921813131.821226120 927065583.858390093 923767096.493965983 941829231.442622662 917540568.647066355 952051875.055215240 958387391.921013832 950375326.495618939
result:
ok 10 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 4056kb
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.142614059 194.596832626 150.264550265 48.475708284 152.229845626 73.228516046 87.737622728 101.910828025 124.710851856 33.126736482
result:
ok 10 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 4020kb
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.283838239 795.195959679 1340.262610317 3590.647504732 734.463107825 1204.044041799 568.432537047 761.453449762 1986.669558374 1378.158448339
result:
ok 10 numbers
Test #11:
score: -100
Wrong Answer
time: 0ms
memory: 4044kb
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:
1000238380.205361605 1000117399.155002236 1000477300.104046106 1000099931.082080126 1000588394.032154083 1000588395.032154083 1000195905.092631698 1000588385.032154083 1000400382.020944715 1000103487.020506382 1000192903.165345073 1000588403.032154202 1000238353.205361485 1000192916.165345073 100014...
result:
wrong answer 3rd numbers differ - expected: '1000289896.62139', found: '1000477300.10405', error = '0.00019'