Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
rename mmch
  • Loading branch information
grondilu committed Apr 28, 2013
1 parent fcc2adb commit b3c75b3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions rosalind/mmch-grondilu.pl
@@ -0,0 +1,21 @@
use v6;

sub C($k, $n) {
if $k < 0 or $k > $n { return 0 }
elsif $k < 2 { return $n }
elsif $k == $n { return 1 }
else {
return (state @)[$n][$k] //= C($k-1, $n-1) + C($k, $n-1)
}
}

sub postfix:<!>(Int $n) { [*] 1 .. $n }

my $rna = lines[1..*-1].join;
given $rna.comb.bag {
say
C(.<A U>.min, .<A U>.max) * .<A U>.min! *
C(.<C G>.min, .<C G>.max) * .<C G>.min!;
}

# vim: ft=perl6

0 comments on commit b3c75b3

Please sign in to comment.