Guest User

Untitled

a guest
Oct 2nd, 2017
210
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <fstream>
  4. #include <vector>
  5. #include <string>
  6. #include <cmath>
  7. #include <map>
  8. #include <utility>
  9. #include <algorithm>
  10. #include <set>
  11. #include <ctime>
  12.  
  13. using namespace std;
  14.  
  15. int main() {
  16.  
  17.     int N, K;
  18.    
  19.     cin >> N >> K;
  20.    
  21.     vector<int> row(N+1);
  22.     vector<vector<int>> dp(K+1, row);
  23.    
  24.     for(int i=1; i<=K; i++)
  25.         dp[i][0] = dp[i][1] = 1;
  26.    
  27.     for(int h=1; h<=K; h++)
  28.         for(int n=1; n<=N; n+=2)
  29.             for(int c=1; c<n; c+=2)
  30.                 dp[h][n] = (dp[h][n] + dp[h-1][c]*dp[h-1][n-c-1])%9901;
  31.    
  32.     cout << (dp[K][N] - dp[K-1][N] + 9901)%9901 << endl;
  33.    
  34.     int k  = 0;
  35.     cout << "kn ";
  36.     for (int i = 0; i <= N; i++)
  37.         cout << i << " ";
  38.     cout << endl;
  39.    
  40.     for (auto e : dp)
  41.     {
  42.         cout << k << ": ";
  43.         for (auto u : e)
  44.             cout << u << " ";
  45.         cout << endl;\
  46.         k++;
  47.     }
  48.    
  49.     return 0;
  50. }
RAW Paste Data