#include <iostream>
#include <algorithm>
using namespace std;

const int maxn = 1000 + 20;
int n, m, M;
int dp[maxn][maxn];

/*
4
3
10000
*/
void solve()
{
    cin >> n >> m >> M;
    dp[0][0] = 1;
    //dp[i][j] = 存储着 j 的 i划分 
    for (int i = 1; i <= m; i++)
    {
        for (int j = 0; j <= n; j++)
        {
            if (j - i >= 0) {
                dp[i][j] = (dp[i - 1][j] + dp[i][j - i]) % M;
            }
            else {
                dp[i][j] = dp[i - 1][j];
            }
        }
    }
    cout << dp[m][n] << endl;
}

int main()
{
    solve();
    
    return 0;
    
}

 

相关文章:

  • 2021-06-15
  • 2021-09-18
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
相关资源
相似解决方案