Water

不难发现,我们期望把尽可能多的杯子里面的水集中到一个杯子里面去。

所以存在以下两种情况:

  • 可以把所有杯子里面的水集中到一个杯子里面,这个时候答案就是 b×nb\times n

  • 或者,一个杯子最多只能装下 ab\lfloor \frac{a}{b} \rfloor 个杯子中的全部水,不能集中全部杯子的。这个时候答案就是 ab×b\lfloor \frac{a}{b} \rfloor \times b

#include<bits/stdc++.h>
using namespace std;
int main(){
//	freopen("text2.in","r",stdin);
//	freopen("text2.out","w",stdout);
	long long a,b,n;
	cin>>a>>b>>n;
	if(b*n<=a)	cout<<b*n<<endl;
	else	cout<<a/b*b<<endl;
}
posted @ 2023-12-21 13:21  June_Failure  阅读(10)  评论(0)    收藏  举报  来源