public class C { public static void printAllFoids(int N){ printProcess(1,N,true); } public static void printProcess(int i,int N,boolean down){ //i是节点的层数,N是一共的层数,down==true 凹 down==false 凸 if(i>N){ return; }else {printProcess(i+1,N,true);} System.out.print(down ?"凹":"凸"); printProcess(i+1,N,false); } public static void main (String[]args){ int N=3; printAllFoids(N); }}