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

Share your thoughts on this with a beginner.

Revision en2, by black.af, 2020-12-11 14:28:47

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 /predownloaded/b7/9b/b79bcb1a9b611b96482a680140141d87ff76888c.jpg

Tags #recursion, #dp

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English black.af 2020-12-11 19:18:17 95
en3 English black.af 2020-12-11 14:31:45 7
en2 English black.af 2020-12-11 14:28:47 67 Tiny change: 'e below**_' -> 'e below**_\nhttps://codeforces.me/4c2684/Screenshot (16).jpg'
en1 English black.af 2020-12-11 14:27:03 1193 Initial revision (published)