百渡网测题:(n-a)*(m-b)<=k,求a+b的最小值
代码如下:
#include
using namespace std;
int main()
{
int n, m, k;
cin >> n >> m >> k;
int temp = 0;
int s =1000;
for (int a = 0; a<n; a++)
{
for (int b = 0; b<m; b++)
{
if ((n - a)*(m - b) <= k)
{
temp = a + b;
if (temp <= s)
s = temp;
}
}
};
cout << s << endl;
return 0;
}