超越 @AC君
2026-09-13 14:29:48
发布于:广东
19阅读
0回复
0点赞
执行用时:0ms
内存消耗:1.39MB
击败了76.58%的用户
击败了98.97%的用户
#include <cstdio>
int main() {
int c, n = 0;
while ((c = getchar()) >= '0' && c <= '9') n = n * 10 + c - '0';
int ans = 1000000000;
for (int i = 0; i < 3; i++) {
int num = 0, price = 0;
while ((c = getchar()) < '0' || c > '9');
while (c >= '0' && c <= '9') { num = num * 10 + c - '0'; c = getchar(); }
while ((c = getchar()) < '0' || c > '9');
while (c >= '0' && c <= '9') { price = price * 10 + c - '0'; c = getchar(); }
int cnt = (n + num - 1) / num;
int cost = cnt * price;
if (cost < ans) ans = cost;
}
char buf[12];
int len = 0;
if (ans == 0) buf[len++] = '0';
while (ans) { buf[len++] = '0' + ans % 10; ans /= 10; }
while (len) putchar(buf[--len]);
putchar('\n');
return 0;
}
全部评论 1
已通过
100%
2026-09-13 14:30:48
0ms
1.50MB
C++
Liu
已通过
100%
2026-09-13 14:28:46
0ms
1.39MB
C++
Liu 上面是AC君的,下面是我的2026-09-13 来自 广东
0





有帮助,赞一个