QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#545481 | #5115. Clone Ranran | ucup-team1329# | AC ✓ | 26ms | 3728kb | C++14 | 2.1kb | 2024-09-03 13:46:14 | 2024-09-03 13:46:15 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define all1(x) x.begin() + 1, x.end()
#define bit1(x) __builtin_popcountll(x)
#define Pqueue priority_queue
#define lc p << 1
#define rc p << 1 | 1
#define IOS ios::sync_with_stdio(false), cin.tie(0);
#define fi first
#define se second
#define lowbit(x) (x & -x)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<ll, ll> PII;
const ll mod = 1000000007;
const ll N = 1e6 + 10;
const ld eps = 1e-9;
const ll inf = 1e18;
const ll P = 131;
const ll dir[8][2] = {1, 0, 0, 1, -1, 0, 0, -1, 1, 1, 1, -1, -1, 1, -1, -1};
void solve()
{
ll a, b, c;
cin >> a >> b >> c;
ll ans = c * b;
for (int i = 1; i <= 30; i++)
{
ll cnt = 1ll << i;
ans = min(ans, i * a + (c + cnt - 1) / cnt * b);
}
cout << ans << "\n";
}
int main()
{
IOS int T = 1;
cin >> T;
while (T--)
solve();
return 0;
}
/*
oxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxox
x o
o _/_/_/_/ _/ x
x _/ o
o _/_/_/_/ _/ _/_/ _/_/ _/_/_/ _/_/ _/_/_/ _/_/ _/_/_/ _/ _/ _/ x
x _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ o
o _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ x
x _/ _/ _/_/ _/ _/ _/ _/_/_/ _/_/ _/ _/ _/ _/ _/ o
o _/ _/ _/ x
x _/ _/_/ _/ o
o x
xoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxo
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3728kb
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: 0
Accepted
time: 26ms
memory: 3636kb
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:
31000000000 31000000000 31000000000 31000000000 31000000000 31000000000 31000000000 31000000000 31000000000 31000000000 30999999998 30999999998 30999999998 30999999998 30999999998 30999999998 30999999998 30999999998 30999999998 30999999998 30999999996 30999999996 30999999996 30999999996 30999999996 ...
result:
ok 99500 numbers