| 记录编号 |
550784 |
评测结果 |
AAAAAAAAAAAAAAAAAAAT |
| 题目名称 |
3382.丢鸡蛋 |
最终得分 |
95 |
| 用户昵称 |
斯内普和骑士 |
是否通过 |
未通过 |
| 代码语言 |
C++ |
运行时间 |
5.871 s |
| 提交时间 |
2020-03-17 21:21:49 |
内存使用 |
14.42 MiB |
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
const int maxn=10005,INF=0x3f3f3f3f;
int h,n;
int dp[maxn][20];
int main()
{
freopen("eggs.in","r",stdin);
freopen("eggs.out","w",stdout);
scanf("%d%d",&h,&n);
for(int i=1;i<=h;i++)
{
dp[i][1]=i;
for(int j=2;j<=n;j++)
{
dp[i][j]=INF;
for(int k=1;k<=i;k++)
{
dp[i][j]=min(dp[i][j],max(dp[k-1][j-1],dp[i-k][j])+1);
}
}
}
printf("%d\n",dp[h][n]);
return 0;
}