比赛 |
2024暑假C班集训D |
评测结果 |
AAAAAAAAAA |
题目名称 |
鹰蛋 |
最终得分 |
100 |
用户昵称 |
darkMoon |
运行时间 |
0.292 s |
代码语言 |
C++ |
内存使用 |
11.07 MiB |
提交时间 |
2024-07-13 11:52:54 |
显示代码纯文本
- #include<bits/stdc++.h>
- #define int long long
- using namespace std;
- // #define fin cin
- // #define fout cout
- ifstream fin("eagleegg.in");
- ofstream fout("eagleegg.out");
- auto mread = [](){
- int x;
- fin >> x;
- return x;
- };
- const int N = 1e3 + 5;
- int n = 1000, m = 10, f[N][N];
- signed main(){
- memset(f, 0x3f, sizeof(f));
- for(int i = 1; i <= 10; i ++){
- f[1][i] = 1;
- f[0][i] = 0;
- }
- for(int i = 2; i <= n; i ++){
- for(int j = 1; j <= m; j ++){
- for(int k = 1; k <= i; k ++){
- if(j > 1){
- f[i][j] = min(f[i][j], max(f[k - 1][j - 1], f[i - k][j]) + 1);
- }
- else{
- f[i][j] = f[i - 1][j] + 1;
- }
- }
- }
- }
- int a, b;
- while(fin >> a){
- fin >> b;
- if(a == 0 && b == 0){
- return 0;
- }
- fout << f[b][min(10ll, a)] << "\n";
- }
- return 0;
- }