19: Use two colors to dye the six pieces in a circle. If you get them through rotation, you can only calculate one of them. How many kinds of dyeing are there:

Source: Internet
Author: User

19: Use two colors to dye the six pieces in a circle. If you get them through rotation, you can only calculate one of them. How many kinds of dyeing are there:

A: 10 B: 11 C: 14: D: 15

Answer: c

Explanation: there should be 14 solutions with only black and white colors by default. Then, P (n) indicates that there are n black games.

P (0) = P (6) = 1

P (1) = P (5) = 1

P (2) = P (4) = 3 // adjacent, one separated, one of two


P (3) = 4 // one adjacent to each other, one of bb0b, one of bb00b, And one of b0b0b. A total of four

24: assume that the rand_k function returns a random number (k> = 2) between [1, K] at random, and each certificate has the same probability. Currently, rand_7 is available. By calling rand_7 () and four Arithmetic Operators and adding logical judgment and cyclic control logic as appropriate, the following functions can be implemented:

A: rand_3 B: rand_21 C: rand_23 D: rand_49

Answer: ABCD

Explanation: for direct truncation of rand_x (x <7), as long as the number of Rand is greater than X, the probability of rand_x is equal. For others, use 7 × RAND _ 7 + rand_7. You can use-7 to get rand_49. Then, split it into rand_42 and divide it by 2. Then, rand_21 is used.

19: Use two colors to dye the six pieces in a circle. If you get them through rotation, you can only calculate one of them. How many kinds of dyeing are there:

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.