题解 | 清楚姐姐买竹鼠

清楚姐姐买竹鼠

https://www.nowcoder.com/practice/816dfe69f83042108cf8c74531a94a35?channelPut=tracker2

#include <iostream>
#include <algorithm>
using namespace std;

void solve() {
    long long a, b, x;
    cin >> a >> b >> x;
    if (a <= b / 3) {
        cout << a * x << '\n';
    }
    else {
        cout << (b * (x / 3) + min(b, a * (x % 3))) << '\n';
    }
}

void run() {
    int t = 1;
    // cin >> t;
    while (t-- > 0) {
        solve();
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //
    run();
}

全部评论

相关推荐

点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务