A simple one to start with. A romantic, but perhaps not very imaginative, boy is planning to repeat the gifts in the Christmas carol “The Twelve days of Christmas”, and wants to be able to plan the “storage” for the gifts. How big an aviary will he need (just the number of birds it will hold), and how big a hotel will he need for the human “gifts”?
If in doubt about the gifts, we'll use the "standard" set given in the Fount of All Knowledge:
https://en.wikipedia.org/wiki/The_Twelv ... mas_(song)
Comment: Extra credit for a nice graphical presentation, perhaps going through the song….
The twelve days of Christmas
Re: The twelve days of Christmas
Here's my minimal solution:
Code: Select all
PRINT "There are 12 'types', which each get presented (13-n) times"
PRINT "Types 1-4 and 6-7 are birds (Type 5 is gold rings!) "
PRINT "Types 8-12 are people"
birds%=0
people%=0
FOR x% = 1 TO 12
items% = x%*(13-x%)
IF x%<8 AND x%<>5 THEN birds% += items%
IF x%>7 THEN people%+=items%
PRINT "Type ";x%;" generates a total of ";items%; "items"
NEXT x%
PRINT "There are a total of ";birds%;" birds"
PRINT "There are a total of ";people%;" people"