SHARE
TWEET

Untitled

a guest Jun 16th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <stdbool.h>
  5. #include <string.h>
  6. long long memo[68][34] ;
  7.  
  8. long long steviloGorovij(long long n, long long visina){
  9.     if(visina<0){
  10.         return 0;
  11.     }
  12.    
  13.     else if(n==0&&visina!=0){
  14.         return 0;
  15.     }
  16.     else if(n==0&&visina==0){
  17.         return 1;
  18.     }
  19.     else{
  20.         if(memo[n][visina] != '\0') return memo[n][visina];
  21.         else{
  22.             memo[n][visina] = steviloGorovij(n-1, visina+1) + steviloGorovij(n-1, visina-1);
  23.             return memo[n][visina];
  24.         }
  25.     }
  26.  
  27.  
  28.  
  29. }
  30.  
  31.  
  32. int main() {
  33.     int n;
  34.     scanf("%d", &n);
  35.     printf("%lld", steviloGorovij(n, 0));
  36.     return 0;
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top