Skip to content

Commit 301dfa9

Browse files
author
L. Grondin
committed
[rosaling] ASPC
1 parent d282fbb commit 301dfa9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

rosalind/aspc-grondilu.pl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use v6;
2+
3+
sub postfix:<!> { [*] 1 .. $^n }
4+
sub C($n, $k) { $n! div ($k! * ($n-$k)!) }
5+
my ($n, $m) = $*IN.get.split(' '.Int;
6+
7+
my $sum = my $C = C $n, $m;
8+
for $m+1 .. $n -> $k {
9+
$C = $C * ($n - $k + 1) div $k;
10+
"$k: ", $sum += $C;
11+
}
12+
say $sum % 1_000_000;
13+
14+
# vim: ft=perl6

0 commit comments

Comments
 (0)