[PKU] P1306: Combinations


the exact number of ways that N things can be taken M at a time can be
a great challenge when N and/or M become very large. Challenges are the
stuff of contests. Therefore, you are to make just such a computation
given the following:
GIVEN: 5 <= N <= 100; 5 <= M <= 100; M <= N

Compute the EXACT value of: C = N! / (N-M)!M!

You may assume that the final value of C will fit in a 32-bit
Pascal LongInt or a C long. For the record, the exact value of 100! is:



input to this program will be one or more lines each containing zero or
more leading spaces, a value for N, one or more spaces, and a value for
M. The last line of the input file will contain a dummy N, M pair with
both values equal to zero. Your program should terminate when this line
is read.


The output from this program should be in the form:

N things taken M at a time is C exactly.

Sample Input

Sample Output



[#M_ more.. | less.. |

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *