11.扔鸡蛋问题(Egg Dropping Puzzle)
int dp[11][51];
void minTrials(){
for (int i = 1; i <= 10; ++i){
dp[i][1] = 1;
}
for (int j = 1; j <= 50; ++j){
dp[1][j] = j;
}
for (int i = 2; i <= 10; ++i){
for (int j = 2; j <= 50; ++j){
dp[i][j] = 1 + dp[i][j - 1];
for (int k = 2; k <= j; ++k){
dp[i][j] = min (dp[i][j], 1 + max (dp[i - 1][k - 1], dp[i][j - k]));
}
}
}
}
int main() {
int t;
cin >> t;
minTrials();
while (t--){
int n, k;
cin >> n >> k;
cout << dp[n][k] << endl;
}
return 0;
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。