QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#247378 | #6423. Fireworks | Lionel_ZQY# | TL | 611ms | 3664kb | C++20 | 650b | 2023-11-11 14:12:54 | 2023-11-11 14:12:55 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using db = long double;
db qpow(db a,i64 n){
db ans=1;
while(n){
if(n&1){
ans=(ans*a);
}
a=(a*a);
n>>=1;
}
return ans;
}
void solve(){
i64 n,m,p;
cin>>n>>m>>p;
cout<<fixed<<setprecision(10);
db ans=1e9;
for(i64 i=1;i<=1e6;i++){
db res=1.0/(1.0-qpow(1.0-(1.0*p/10000.0),i))*(1.0*n*i+m);
ans=min(res,ans);
}
cout<<ans<<"\n";
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int t;
cin>>t;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 611ms
memory: 3664kb
input:
3 1 1 5000 1 1 1 1 2 10000
output:
4.0000000000 10141.5852891147 3.0000000000
result:
ok 3 numbers
Test #2:
score: -100
Time Limit Exceeded
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