diff --git "a/problems/0070.347円210円254円346円245円274円346円242円257円345円256円214円345円205円250円350円203円214円345円214円205円347円211円210円346円234円254円.md" "b/problems/0070.347円210円254円346円245円274円346円242円257円345円256円214円345円205円250円350円203円214円345円214円205円347円211円210円346円234円254円.md" index 4fa294cfe2..622b1117e7 100644 --- "a/problems/0070.347円210円254円346円245円274円346円242円257円345円256円214円345円205円250円350円203円214円345円214円205円347円211円210円346円234円254円.md" +++ "b/problems/0070.347円210円254円346円245円274円346円242円257円345円256円214円345円205円250円350円203円214円345円214円205円347円211円210円346円234円254円.md" @@ -165,7 +165,21 @@ class climbStairs{ ``` ### Python3: +```python3 +def climbing_stairs(n,m): + dp = [0]*(n+1) # 背包总容量 + dp[0] = 1 + # 排列题,注意循环顺序,背包在外物品在内 + for j in range(1,n+1): + for i in range(1,m+1): + if j>=i: + dp[j] += dp[j-i] # 这里i就是重量而非index + return dp[n] +if __name__ == '__main__': + n,m = list(map(int,input().split(' '))) + print(climbing_stairs(n,m)) +``` ### Go:

AltStyle によって変換されたページ (->オリジナル) /