1 /**2 * Origami Problem This code is too low to write my level limited ah ... It's all a string.3 * @paramN4 * @return5 * @date 2016-10-76 * @authorshaobn7 */8 Public StaticString[] Flodpaper (intN) {9 intLength = (int) Math.pow (2,n)-1;Ten intPosition = (int) Math.pow (2,n-1)-1; OneString[] Strings =NewString[length]; AStrings[position] = "Down"; - if(n==1){ - returnstrings; the}Else { -String string_2 =NewString (); - for(String String:flodpaper (n-1)){ -string_2+=string; +string_2+= ""; - } +string_2+= "Down"; Astring_2+= ""; atString String_3 =NewString (); - for(String String:flodpaper (n-1)){ - if(String.Equals ("Down")){ -string_3+= "Up"; -string_3+= ""; -}Else { instring_3+= "Down"; -string_3+= ""; to } + } -string[] Strings4 = String_3.split (""); the for(inti = strings4.length-1;i>=0;i--){ *string_2+=Strings4[i]; $string_2+= "";Panax Notoginseng } -string[] Strings2 = String_2.split (""); the returnStrings2; + } A}
Please put the note upright on the table, and then from the bottom of the note upward? Fold, press the crease and then unfold. At this time there are 1 creases, protruding? To the back of the note, this crease is called "bottom" crease; the crease that points to the note is called the "top" crease. What if it goes from bottom to top every time? Fold in half and fold n times. Please calculate all the creases from top to bottom.
Given the number of times nof a fold, return an array of creases from top to bottom, if the corresponding element is "down", if the crease is "up"
Origami Problem Java implementation