题解 | #放苹果#
放苹果
https://www.nowcoder.com/practice/4f0c1e21010e4d849bde5297148e81d9
#include<iostream> using namespace std; const int N = 100; int f[N][N]; int main(void) { int m,n; cin >> m >> n; for(int i = 1; i<= n;i++) f[0][i] = 1; for(int i = 1;i <= m;i++) { for(int j = 1;j <= n;j++) { if(j > i) f[i][j] = f[i][i]; else { f[i][j] = f[i][j - 1] + f[i - j][j]; } } } cout << f[m][n] << endl; return 0; }