Submit | All submissions | Best solutions | Back to list |
QCJ2 - Another Box Problem |
There are N numbered boxes placed on a table, let Bi denote the ith box in the line. Write a program that finds the total number of ways to place N identical balls such that at most k balls are present in the boxes B1 .... Bk for 1<=k<=N. Since the number can be quite large you are supposed to output the answer modulo 761238923.
Input
Input will contain multiple testcases, on each line N (1<=N<=100) will be given. The last line contains 0 which should not be processed.
Output
For each testcase output exactly one line, the total number possible of ways modulo 761238923.
Example
Input:
1
2
0
Output: 1
2
Added by: | abhijith reddy d |
Date: | 2010-02-01 |
Time limit: | 0.200s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS OBJC PERL6 SQLITE VB.NET |
Resource: | Own |
hide comments
|
|||||
2012-05-14 11:34:28 :D
Ok, explanation for N=3: {0,0,3}, {0,1,2}, {0,2,1}, {1,0,2}, {1,1,1}. {1,2,0} is incorrect, because of what previous comment states. |
|||||
2011-10-16 18:59:45 Rohan
what is the answer for 3? I am getting it as 6. {1,1,1}, {1,2,0}, {0,0,3}, {1,0,2}, {0,2,1}, {0,1,2}. |
|||||
2011-01-16 01:10:58 :D
This really should be edited in the description. I also was sure that there should be at most k balls in every single box Bk not in whole sequence B1,...,Bk in total. |
|||||
2010-05-30 23:55:17 David Gómez
@anshu saurabh: My code gives 116769572 |
|||||
2010-03-11 03:21:13 Anshu Saurabh
what should be output for 100 my code is giving 456111716 |
|||||
2010-02-10 00:22:37 setsquare
Case 2 explanation: There are 3 arrangements { [oo],[]}, { [o],[o]} and { [],[oo] }. But Box1 can only have 1 ball maximum, so we can eliminate the first arrangement leaving 2 arrangements Last edit: 2010-02-10 00:24:22 |
|||||
2010-02-06 13:35:37 hendrik
Could someone explain the case 2? |
|||||
2010-02-02 13:05:04 [Rampage] Blue.Mary
Thanks very much for the hint. |
|||||
2010-02-01 10:27:08 Oleg
agree :) |
|||||
2010-02-01 10:19:14 Spooky
a bit misleading statement actually... should be "in the boxes B1, .... ,Bk in total" or something like this... |