serega1112

ball on the staircase

Jan 24th, 2021
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.17 KB | None | 0 0
  1.  
  2. n = int(input())
  3.  
  4. dp = [0] * (n + 1)
  5. dp[0] = 1
  6.  
  7. for i in range(n):
  8.     for s in range(1, 4):
  9.         if i + s <= n:
  10.             dp[i+s] += dp[i]
  11.  
  12. print(dp[n])
Advertisement
Add Comment
Please, Sign In to add comment