力扣第887题 鸡蛋掉落
class Solution {
public:
int superEggDrop(int K, int N)
{
vector<vector<int>> dp(K+1, vector<int>(N+1, 0));
int m = 0;
for (; dp[K][m] < N;) {
m++;
for (int k = 1; k <= K; k++)
dp[k][m] = 1 + dp[k-1][m-1] + dp[k][m-1];
}
return m;
}
};
原文地址:https://www.cnblogs.com/woodjay/p/12683047.html
时间: 2024-10-07 23:24:05