BALLS - Distributing the balls

In this task you have compute the number of ways we can distribute A balls into B cells with with every cell having at-least one ball. 

Input

The inputs A and B are given in a single line separated by a blank,the inputs are terminated by EOF.

Output

Output the answer modulus 247383691.

 

Score

Score is the length of your code.

Example

Input:
12 4
6 3

Output:

14676024
540

Constraints
  • Every A and B can be distinguishable.
  • [math]0 \le A \le 1000000 [\math]
  • [math]0 \le B \le 100 [\math]

Added by::(){ :|: & };:
Date:2011-03-28
Time limit:0.100s-3.163s
Source limit:1000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Own problem

hide comments
2015-09-12 08:12:13 Mitch Schwartz
My submissions 15115055 (WA) and 15115136 (AC) are identical. Maybe some rare bug in SPOJ platform?
2014-06-12 21:03:07 Bhavik
learned quite a few things while implementation:)
2013-11-09 20:10:28 Mitch Schwartz
@Ouditchya Sinha: \le just means less than or equal to; [math] tags aren't used on SPOJ so it's unclear why the problem setter would write it that way.

Edit: I just saw now on http://www.spoj.com/ a news entry from 2011-01-31 stating that [math] tags can be used on SPOJ for mathematical expressions. Perhaps it was a feature that was available for a time and then removed.

Last edit: 2013-11-18 15:36:27
2013-11-09 19:57:19 Ouditchya Sinha
Can anyone please clarify the constraints, they are not appearing properly in my Browser. Thank You. :)
2013-10-28 15:05:37 Decode
@Debanjan:
Plz say where am i wrong:10367658
2012-09-08 18:50:19 (Tjandra Satria Gunawan)(曾毅昆)
I know the formula but i'm getting wa... Is there any tricky test case?
EDIT: Finally AC, and yes there is a tricky case in the input...

Last edit: 2012-09-08 19:07:31
2012-07-24 04:33:44 Aditya Pande
getting tle
2011-06-12 00:27:05 Hallvard Norheim Bø
@HWK: suddenly my solution worked! It still matches yours for all the example inputs you provided.

Finally made it! The last few bytes were hard to cut.

Last edit: 2011-06-12 01:57:53
2011-06-11 22:49:50 HWK
@.:: Debanjan ::.: Could you please say me where my solution 5231091 fails?

Edit: I found my mistake. E.g. 3 3 fails.

Last edit: 2011-06-12 09:05:55
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.