pankaj kumar raman
Last Activity: 13 Years ago
first king can be placed in n*m places
1)one king at corner ,other king will be at = 4 * [(n*m)-4] places = 4mn-16
↑ ↑
4 corners [m*n places - 4 places around]
2)one king at edge, other will be at= [2(n-2)+2(m-2)] * (n*m-5) = 2mn²-10n+2m²n-10m-8mn+40
↑ ↑
number of box at edge m*n places except 5 places around
3)one king at free from corners and edges, other will be at
= [(n-2)*(m-2)] * (n*m-8) = n²m²-2n²m-2nm²-4nm+16n+16m-32
↑ ↑
number of boxes away from ends n*m places except 8 places around
sum of all probablities will be= (nm-4)²+6(m+n-4)