例子java
路徑查找方法app
public static void main(String[] args) { for(int i=0;i<5;i++){ getLog(i); } } private static void getLog(int mid){ int offer=1; StringBuilder builder= new StringBuilder("["+mid+","+mid+"]"); while(offer<=mid){ if(mid%2==0){ builder.insert(0,"["+(mid-offer)+","+mid+"]"); if(mid!=4){ builder.append("["+mid+","+(mid-offer)+"]"); } } else{ builder.append("["+(mid-offer)+","+mid+"]"); builder.insert(0,"["+mid+","+(mid-offer)+"]"); } offer++; } System.out.println(builder.toString()); }