package floatt;
public class Go {
public static int i = 0;
public static void main(String[] args){
calc("", 5);
System.out.println("总共有"+i+"种走法~");
}
//上楼梯每次只需一步或者两步,有多少走法
public static void calc(String log, int num){
if (num == 0) {
i++;
System.out.println(log.substring(0,log.length()-1));
return;
}else if(num == 1) {
i++;
System.out.println(log+"1");
return;
}
calc(log+"1,", num - 1);
calc(log+"2,", num - 2);
}
}