Problem I. 118. (December 2005)
I. 118. We have n ceramic piggy banks and n keys, each corresponding to exactly one of the banks. We throw one key into each bank at random. Then we break open t ceramic pigs. Find the probability that we are able to open the remaining banks using the keys found in the broken ones without any further breaking. Write a program that estimates this probability by making k experiments. If n<10, then we should also compute the exact probability by examining all possible cases.
Your program should read the values of n, t and k from the keyboard, then make the experiments and display the resulting relative frequencies (that is, the ratio of successful outcomes to k), further, the exact probability.
The source code of the program should be submitted (i118.pas, i118.cpp, ...).
Deadline expired on 16 January 2006.