# Thinking about a game (Probability Problem)

Source: Internet
Author: User
A logical question that has aroused national debate among college students across the country: Suppose you are playing a game program. Now you can choose from three doors: one door is behind a car, and the other two are behind a goat. Of course you want to get a valuable car, but you cannot see the real situation behind the door. The host asks you to make the first choice. After you select a door, you will know the host behind the other two doors and open another door to show you. And, of course, there is a goat there. Now the host tells you that you have another chance to choose. So, consider whether you stick to the same choice for the first time or change the choice for the first time to get a car? There are two key points: 1. After you select a door, you will know the host behind the other two. It means that the host knows the correct answer, and he will definitely open a door to close the goat, instead of being blind. 2. Is it more likely to get a car? Obviously, the question is the possibility (probability). The probability of changing or not is high!
Instead of changing it, you will surely get the car!
Conclusion: The probability of changing is higher than that of not changing. Imagine an ideal environment: in the case of a special average, guess the situation of three changes
1. When I selected the car, the host opened the door of a goat. I changed the door and got a goat. 2. I selected goat A. The host opened the door of another goat. I changed the door and got the car. 3. I selected goat B. The host opened the door of another goat. I changed the door and got the car. I guess three times, two times will get the car. 2/3 not changed
1. When I selected the car, the host opened the door of a goat. I didn't change the door, and I got a car. 2. I selected goat A, and the host opened the door of another goat. I didn't change it, and I got goat. 3. I selected goat B, and the host opened the door of another goat. I didn't change it, and I got goat B. I guess three times, only one get the car. 1/3 what? You said it was absolute. In fact, this is the probability. When the number of resources is small, it is very irregular, but after you guess 0.1 million times, you will find that the probability is like this.
I finally summarized the theory as follows: If you had the determination to change at the time: when you made the first decision, if you guessed the right car (this case only has a 1/3 probability), you insisted on changing it, then your second choice will be sheep (that is to say, "the probability of the first car election of 1/3" is changed to "the probability of the second sheep election of 1/3 "). If you select a goat for the first time (with a 2/3 probability) and you want to change it, you will choose a car for the second time (because, the host helped you eliminate a wrong answer, that is, "the probability of the first election of a sheep in 2/3" is changed to "the probability of selecting a car in 2/3 ). // My personal opinion: Is this possible? Because the host knows where the car is, when the host knows that the participant guessed it. What about giving up with probability? (Because, after all, the probability of getting a car after a change is greater ). In this way, the host's trap will be mounted. Haha! (Exciting test !). // Attach source code: (c)

// Add the source code: # include <stdio. h> # include <string. h> # include <stdlib. h> # include <time. h> int main () {srand (unsigned) Time (null); int count_static = 0; int count_change = 0; For (INT trytimes = 0; trytimes <1000000; trytimes ++) {// here is 2 because we already know that there is a door for goat. So there are only two possibilities: int carroom = 1 + (INT) (2.0 * rand ()/(rand_max + 1.0); int selected = 1 + (INT) (2.0 * rand ()/(rand_max + 1.0); If (carroom = selected) {count_static ++ ;}} printf ("if you do not change you selection. /Nyou can select car % d times in 1000000 times/N ", count_static); srand (unsigned) Time (null); For (INT trytimes2 = 0; trytimes2 <1000000; trytimes2 ++) {int carroom = 1 + (INT) (3.0 * rand ()/(rand_max + 1.0); int selected = 1 + (INT) (3.0 * rand ()/(rand_max + 1.0); int del_room = 1 + (INT) (3.0 * rand ()/(rand_max + 1.0 )); while (del_room = carroom | del_room = selected) {// Delete room shouldn't be car room and select room del_room = 1 + (INT) (3.0 * rand () /(rand_max + 1.0);} int select_again = 1 + (INT) (3.0 * rand ()/(rand_max + 1.0 )); while (del_room = select_again | select_again = selected) {select_again = 1 + (INT) (3.0 * rand ()/(rand_max + 1.0 ));} if (carroom = select_again) {count_change ++ ;}} printf ("if you change you selection first. /Nyou can select car % d times in 1000000 times/N ", count_change); Return 0 ;}

Related Keywords:

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.