问题
Scientists at the research institute for robotics have created a new type of robot that reproduces itself. The new robot takes two weeks to gather materials and then builds one new robot(exactly like itself) each week for three weeks. The first new robot is activated at the end of week 3, the second new robot is activated at the end of week 4 and the third new robot at the end of week 5. as soon as it is created, each new robot goes through the same cycle of gathering materials for two weeks and then creating three new robots, one per week. And so on for each of the new robots. At the end of the first five weeks of its existence each new robot ceases building new robots but retires and lives forever. The scientists plan to build only one robot with their own hands and then set it in motion. Create an excel worksheet that will tell you how many robots there will be in 2 years.
i have search but the answer wasn't enough to help me figure this out. any help out there?
回答1:
@yosukesabai is quite right - this is a Markov chain problem, and once you've worked out how to set up the transition matrix it's very easy to solve. If we know how many robots of each age we have at the end of each week (in complete weeks, capped at 5), we can use the transition matrix to calculate the number of robots of each age at the end of the following week.
The transition matrix can be written like this:
0 1 0 0 0 0
0 0 1 0 0 0
1 0 0 1 0 0
1 0 0 0 1 0
1 0 0 0 0 1
0 0 0 0 0 1
For each robot of age y at the end of the week, there will be T(x,y) robots of age x at the end of the next week (x = column number, y = row number, both starting at 0). The entries are all filled in according to the puzzle description.
The starting state in week 0 is a single robot of age 0, and no other robots of any other ages. This can be represented as a row vector:
1 0 0 0 0 0
You can now use the MMULT function to get from week zero to week one. If you put the transition matrix in cells J2:O7 and the vector for week 0 in cells B3:G3, it can be entered as:
=MMULT(B3:G3,$J$2:$O$7)
This needs to be entered as an array formula. Select cells B4:G4, press F2, enter the formula and press Ctrl + Shift + Enter. You should now see the following in B4:G4:
0 1 0 0 0 0
You can then copy & paste these cells down into another 103 rows to see how robots you have after 2 years. I get 5,369,858,819,104 at the end of week 104.
来源:https://stackoverflow.com/questions/8980749/excel-formulation-table