You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
548 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package class07;
public class Code08_PaperFolding {
public static void printAllFolds(int N) {
printProcess(1, N, true);
}
// 递归过程,来到了某一个节点,
// i是节点的层数N一共的层数down == true 凹 down == false 凸
public static void printProcess(int i, int N, boolean down) {
if (i > N) {
return;
}
printProcess(i + 1, N, true);
System.out.println(down ? "凹 " : "凸 ");
printProcess(i + 1, N, false);
}
public static void main(String[] args) {
int N = 3;
printAllFolds(N);
}
}