QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#638255 | #5115. Clone Ranran | wzxtsl# | WA | 82ms | 3716kb | C++23 | 612b | 2024-10-13 15:23:34 | 2024-10-13 15:23:34 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define For(i,aa,a) for(int i=aa;i<=a;i++)
int n,m;
const int N=2e6+7,INF=0x3f3f3f3f;
int a,b,c,ans;
int p[50];
void solve(){
ans=INF;
cin>>a>>b>>c;
For(i,0,30)
{
if(p[i]>=c)
{
ans=min(ans,i*a+b);break;
}
else{
int bb=(c+p[i]-1)/p[i];
ans=min(ans,i*a+b*bb);
}
}
cout<<ans<<endl;
}
signed main(){
int t=1;
p[0]=1;
For(i,1,32)
p[i]=2*p[i-1];
cin>>t;
while(t--){
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3704kb
input:
5 1 1 1 2 3 3 9 9 9 3 26 47 1064 822 1048576
output:
1 7 45 44 21860
result:
ok 5 number(s): "1 7 45 44 21860"
Test #2:
score: -100
Wrong Answer
time: 82ms
memory: 3716kb
input:
99500 1000000000 1000000000 1000000000 1000000000 1000000000 999999999 1000000000 1000000000 999999998 1000000000 1000000000 999999997 1000000000 1000000000 999999996 1000000000 1000000000 999999995 1000000000 1000000000 999999994 1000000000 1000000000 999999993 1000000000 1000000000 999999992 10000...
output:
1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 1061109567 106...
result:
wrong answer 1st numbers differ - expected: '31000000000', found: '1061109567'