代码:
package com.hualing.lanqiao;
import java.util.Scanner;
public class Expansion {
static int tol1 = 0;//计数public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入天数n:");
int n = sc.nextInt();
int tol = getTol(n+1);
System.out.println(tol);
}
public static int getTol(int n) {
tol1++;
int a1 = 0;
for (a1 = 0; a1 < n; a1++) {
if (a1 >= 7 ) {
if(a1 == 8) {
getTol(n-8);
}
for (int j = 1; j <= n; j++) {
if (a1==8+3*j) {
getTol(n-(8+3*j));
}
}
}
}
return tol1;
}
}



