Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

van_persie9's blog

By van_persie9, history, 5 years ago, In English

Recently I came across a question in which we had to find the no. of ways to distribute N balls into 3 boxes such that the number of box getting maximum no. of balls is exactly 1.

For example

  • if N=2, ans is 2 : {2,0,0},{0,2,0},{0,0,2}

  • if N=3, ans is 9 : {3,0,0},{0,3,0},{0,0,3},{3,2,1},{3,1,2},{1,3,2},{2,3,1},{1,2,3},{2,1,3}

Now, since the number of boxes here is only 3, I was able to solve the question by observation and basic maths(Arith. Prog.) My query is how to solve the above question if the number of boxes is K?

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it