跳到正文

题解

P10056 题解

FurippuWRY约 1 分钟
原文
文章信息与版本

文章信息

发布
2024年1月14日
收录
2025年12月12日
更新
2026年11月14日
篇幅
约 1 分钟
题目
P10056

版本

  1. v1当前

可以把所有的水集中在一起,也就是 b×nb \times n,然后判断 b×nb \times n 是否大于 aa,真则输出,若为假,那么最多有 ⌊ab⌋×b\left\lfloor\dfrac{a}{b}\right\rfloor \times b 体积的水,输出即可。

C++
#include<bits/stdc++.h>

using namespace std;

long long a, b, n;

int main() {
    cin >> a >> b >> n;
    if (n * b < a) cout << b * n;
    else cout << a / b * b;
    return 0;
}
原文