Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
import bigints
|
||||
|
||||
proc perm(n, k: int32): BigInt =
|
||||
result = initBigInt 1
|
||||
var
|
||||
k = n - k
|
||||
n = n
|
||||
while n > k:
|
||||
result *= n
|
||||
dec n
|
||||
|
||||
proc comb(n, k: int32): BigInt =
|
||||
result = perm(n, k)
|
||||
var k = k
|
||||
while k > 0:
|
||||
result = result div k
|
||||
dec k
|
||||
|
||||
echo "P(1000, 969) = ", perm(1000, 969)
|
||||
echo "C(1000, 969) = ", comb(1000, 969)
|
||||
Loading…
Add table
Add a link
Reference in a new issue