How would you make a equation that will break a part into smaller pieces and pattern them to the proper size?

I working on a catwalk system currently. I want to make a "Link-in-Log" style system where I can parameterize the sizing and have a catwalk any (Reasonable) size by just imputing length, width, and height. So my main problem is my floor plates cannot be longer than 47.25in. They can be shorter as needed. So how do I make a equation that i can input my length and it will automatically size and pattern my plates to the desired length? Example: Input Value 240in. Desired output, 6 pieces 40in long. or  Input Value 156in. Desired outut, 4 pieces 39in long.

Thank you all in advance!

‌ ‌   

SolidworksModeling And Assemblies