比赛 |
2022级DP专题练习赛5 |
评测结果 |
AAAWWWWWWW |
题目名称 |
鹰蛋 |
最终得分 |
30 |
用户昵称 |
op_组撒头屯 |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2023-02-22 20:48:11 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define vi vector<int>
#define si set<int>
#define unsi unordered_set<int>
#define qi queue<int>
#define sti stack<int>
#define pqi priority_queue<int>
#define mii map<int,int>
#define unmii unordered_map<int,int>
#define fi first
#define se second
#define pb push_back
#define clr(f,n) memset(f,0,sizeof(int)*(n))
#define cpy(f,g,n) memcpy(f,g,sizeof(int)*(n))
const int N=1000+5;
const int inf=0x3f3f3f3f;
int n=100,m;
int f[N][N];
int main(){
freopen ("eagleegg.in","r",stdin);
freopen ("eagleegg.out","w",stdout);
for (int i=1;i<=n;i++)f[1][i]=i;
for (int i=2;i<=n;i++){
for (int j=1;j<=n;j++){
f[i][j]=f[i][j-1]+1;
for (int k=1;k<j;k++){
f[i][j]=min(f[i][j],max(f[i][k-1],f[i-1][j-k])+1);
}
}
}
while(scanf("%d%d",&n,&m)!=EOF){
if (!n&&!m)return 0;
printf("%d\n",f[n][m]);
}
}