public class Solution { public int CalulateMethodCount(int num_money) { if (num_money <= 2) return num_money; long[] dp = new long[num_money + 1]; dp[1] = 1; dp[2] = 2; dp[3] = 4; for (int i = 4; i <= num_money; i++) { dp[i] = (dp[i - 1] + dp[i - 2] + dp[i - 3]); } return (int) dp[num_money]; } }第二题来不及看了哈 有一起老虎的么
全部评论
(0) 回帖