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 atmost 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

hide comments
mastik5h_1998: 2017-09-28 17:30:14

DAMN easy pizzy.....

absolute_zero: 2016-09-28 15:23:18

i am frustated now. after getting WA continuously , when i stored the whole 100 values calculated by my code in an array , I got AC. how is this possible.? same code gives WA.
any help? here is the code - ***************************************

Last edit: 2016-09-28 22:14:08
Wumbolo: 2016-07-08 18:53:09

It's B1+B2+...Bk<=k, not B1<=1, B2<=2...Bk<=k. Comments are misleading, too!

Last edit: 2016-07-08 19:11:07
vaibhavi760: 2016-05-08 09:41:59

why is (1,2,0) incorrect for N=3?

minhthai: 2016-04-15 02:52:59

No more than k balls in the whole sequence B_i, B_(i + 1)..., B_k

Rishi Vikram: 2016-03-03 01:44:08

TL strict for Python, same code gives AC in C++

Last edit: 2016-03-03 01:45:23
Beta Projects: 2015-10-16 06:58:50

Same solution as MCIRGAME. O(1)

RajatBajaj: 2015-06-24 12:47:20

green in 1 go... : ) ..O(n^2)

janina: 2015-06-24 09:18:53

good one....dp is really magical ;)......time complexity O(n^3)..

Last edit: 2015-06-24 09:19:52
Naman Goyal: 2015-05-20 22:30:52

Is better than O(n^3) solution possible?


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