QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#76624 | #5115. Clone Ranran | perspective | TL | 0ms | 3340kb | C++23 | 947b | 2023-02-11 04:21:11 | 2023-02-11 04:21:13 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP1(i, n) for(ll i = 0; i < (n); i++)
#define REP2(i, a, b) for(ll i = (a); i < (b); i++)
#define REP0(n) for(ll iii = 0; iii < (n); iii++)
#define overload3(a, b, c, name, ...) name
#define rep(...) overload3(__VA_ARGS__, REP2, REP1, REP0)(__VA_ARGS__)
#define vl vector<ll>
#define all(v) v.begin(), v.end()
#define fore(e, v) for(auto &&e : v)
template <typename T, typename S> bool chmax(T &x, const S &y) { return (x < y ? x = y, true : false); }
template <typename T, typename S> bool chmin(T &x, const S &y) { return (x > y ? x = y, true : false); }
int main() {
int T;
cin >> T;
rep(T) {
ll a, b, c;
cin >> a >> b >> c;
ll mi = 1e18;
rep(i, 31) {
ll now = 1LL << i;
chmin(mi, a * i + (c + (now - 1)) / now * b);
}
cout << mi << endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3340kb
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
Time Limit Exceeded
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 ...