QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#76624#5115. Clone RanranperspectiveTL 0ms3340kbC++23947b2023-02-11 04:21:112023-02-11 04:21:13

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-11 04:21:13]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3340kb
  • [2023-02-11 04:21:11]
  • 提交

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;
    }
}

詳細信息

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
...

result: