Origami Problem Java implementation

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.