public int translateNum(int num) { //动态规划 if(num<10) return 1; String s = String.valueOf(num); int len = s.length(); int[] dp = new int[len+1]; dp[0] = 1; dp[1] = 1; int i = 2; while(i<=len){ int x = Integer.parseInt(s.substring(i-2,i)); if(x>=10 && x<=25){ dp[i] = dp[i-1]+dp[i-2]; i++; }else{ dp[i] = dp[i-1]; i++; } } return dp[len]; }