思路:
有 个苹果,每 分钟能吃一个苹果,吃了 分钟,问还有几个完整的苹果。我们可以知道,在 分钟内,可以吃 个苹果。那么剩下的就是 个苹果。注意 是否为 。 要向下取整。
代码:
#include<bits/stdc++.h>
using namespace std;
int m,t,s;
int main()
{
cin>>m>>t>>s;
if(t==0)
{
cout<<0<<endl;
return 0;
}
if(s%t==0)
{
if(m-s/t>=0)
cout<<m-s/t;
else cout<<0;
}
else
{
if(m-s/t-1>=0)
cout<<m-s/t-1;
else cout<<0;
}
return 0;
}