Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <fstream>
- #include <vector>
- #include <string>
- #include <cmath>
- #include <map>
- #include <utility>
- #include <algorithm>
- #include <set>
- #include <ctime>
- using namespace std;
- int main() {
- int N, K;
- cin >> N >> K;
- vector<int> row(N+1);
- vector<vector<int>> dp(K+1, row);
- for(int i=1; i<=K; i++)
- dp[i][0] = dp[i][1] = 1;
- for(int h=1; h<=K; h++)
- for(int n=1; n<=N; n+=2)
- for(int c=1; c<n; c+=2)
- dp[h][n] = (dp[h][n] + dp[h-1][c]*dp[h-1][n-c-1])%9901;
- cout << (dp[K][N] - dp[K-1][N] + 9901)%9901 << endl;
- int k = 0;
- cout << "kn ";
- for (int i = 0; i <= N; i++)
- cout << i << " ";
- cout << endl;
- for (auto e : dp)
- {
- cout << k << ": ";
- for (auto u : e)
- cout << u << " ";
- cout << endl;\
- k++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement