为什么10分

tctm169 杀手 2024-05-19 18:07:25 4

#include <stdio.h> int f[110][20]; int max(int a, int b) { return a > b ? a : b; } int min(int a, int b) { return a < b ? a : b; } int main() { int n, m, i, j, k; while (scanf("%d%d", &n, &m) != EOF) { for (i = 1; i <= n; i++) for (j = 1; j <= m; j++) f[i][j] = i; for (i = 1; i <= n; i++) for (k = 1; k <= i; k++) for (j = 2; j <= m; j++) f[i][j] = min(f[i][j], max(f[k - 1][j - 1], f[i - k][j]) + 1); //+1表示当前尝试? printf("%d\n", f[n][m]); } return 0; }

{{ vote && vote.total.up }}

共 1 条回复

root 站长

数据错误,已经修复