sir, tell the full solution
U have n identical coins...
How to divide it into k parts such that each part has a
maximum of M and a minimum of N?
-
UP 0 DOWN 0 0 5
5 Answers
first put N coins in each of the k parts..
SO we are left with n-Nk coins...
Now divide the remaining n-Nk coins such that each part gets maximum of M coins.. how will that be done?
We have to divide N coins in k parts such that each part has atleast N coins.
first put N coins in each of the k parts..(This fulfils our 1st requirement!)
Now, we are left with n-Nk coins...
Now we need to divide the remaining n-Nk coins such that each part has at maximum M coins..
now n-Nk is any number say x
So the question reduces to a simpler question divide x coins into N parts such that no one gets more than M-N=y(let) coins! (each person already has N coins)
or x=x1+x2+.......+xN
0<=x1,x2,x3....,xN<=y