A frog can jump up 1 step, 2 steps, or 3 steps at a time. How many ways are there to jump 100 steps?

A frog can jump up 1 step, 2 steps, or 3 steps at a time. How many ways are there to jump 100 steps?

Dynamic programming? wrong please scold me

public void solve(){
    
    
        String dp[] = new String[101];
        dp[0] = "0";
        dp[1] = "1";
        dp[2] = "2";
        dp[3] = "4";
        for(int i=4;i<=100;i++){
    
    
             BigInteger bi1 = new BigInteger(dp[i-1]);
             BigInteger bi2 = new BigInteger(dp[i-2]);
             BigInteger bi3 = new BigInteger(dp[i-3]);
             dp[i] =bi1.add(bi2.add(bi3)).toString();
             System.out.println("dp"+i+"是"+dp[i]);
        }
        return;
    }

dp99 is 98079530178586034536500564
dp100 is 180396380815100901214157639

Guess you like

Origin blog.csdn.net/weixin_42538406/article/details/125520744