Please read the new rule regarding the restriction on the use of AI tools. ×

black.af's blog

By black.af, history, 4 years ago, In English

[Your text to link here...]Hi everyone! I am a beginner in programming and I would like to have your opinion on this problem. In my opinion the program should return the number of partition of the number of bricks n (those containing only 1 and 2). On the other hand it seems that the sequence of bricks looks like a Fibonacci sequence. I am a bit confused. Please help me!

We build a wall by the brick, the height of the brick is twice as long as the width of the brick, and the height of the wall is equal to the height of the brick. Observe the figure below , 2 bricks has two possible building methods, 3 bricks has three possible building methods. Please design a program, input an non-negative integer less than 40, output the number of possible building methods. When entering 0, ends the loop. Input Your program receives a sequence of positive integers, one per line, each representing the length of a wall. The maximum value for the wall is length 40. The input terminates with a 0 Output For each wall length given in the input, your program must output the corresponding number of different patterns for such a wall in a separate line. See picture below !

Full text and comments »

  • Vote: I like it
  • -23
  • Vote: I do not like it