题目如下
Suppose you have a chessboard with N rows and M columns. Each time yourandomly select a blank cell in the chessboard and put a chessman on it, until eachrow and each column contains at least one chessman. Then what is the expectedvalue of the number of chessmen in the chessboard? Use R program to implementthe above process and compute the expected value.
我的想法是建立一个零矩阵,做循环检验每行每列元素之和是否大于等于1,但是写不出来程序,可能我的想法就出了问题,求助大佬们