[Original Dream] questions about cats and mice (program algorithms)

Source: Internet
Author: User
Really, I dreamed of it last night.

A mouse ran to a friend's house, and my friend refused to kill it and said it was cute. The result quickly became a problem.
Then I woke up, hey! I don't know what preference this dream is. I haven't found Zhou gongjie on the Internet for a long time.
However, I woke up after my dream was completed. I thought of a program question, which I had come up:

There were 30 mice in one household, which were so rampant that they could not imagine. So they bought two cats and then came back with interesting changes.
Mouse growth rules:
4-8 mice in a nest (random number), then each two mice in a nest, each 7-15 born nest (random number ), 5-10 days after the birth of the mouse mature (random number), can give birth. The normal survival period of the mouse is-days (random number ).
The growth pattern of cats:
A cat has 1-6 kittens (random numbers). Of course, every two cats are responsible for a nest. Every 30-60 cats have a nest (random number ), the generated kitten is 40-60 days mature (taking a random number) and can have children. The normal survival period of a cat is 3-7 years (taking a random number ).
Rules for cats and mice:
When a cat is born, it eats 0-15 mice on average for 10 days (taking random numbers ). If a cat does not eat a mouse for 25-30 days (taking a random number), the cat will starve to death.

If there are other required parameters that haven't been specified, you can set them by yourself. Don't be too outrageous!

The above are the conditions for this program question. It has not been verified yet. Will the mouse be destroyed in the middle? It is not fun to destroy it too early, hey. If the mouse is destroyed halfway, how many days have it been destroyed? How many cats are there in the statistical data during extinction? Of course, the cats will eventually die. How many days will the cats die?

Write a program based on the preceding conditions to calculate the number of cats and mice in the family after 10 years (two runner-up may occur in these 10 years, there are too many cats and mice in total. Hey! It's interesting.

Ask the boss to give me a design idea first. It is very interesting to come up with this question ....

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.