Пример #1
0
def pper(n, k, r=1000000L):
    return ro.prod_mod(xrange(n, n - k, -1), r)
Пример #2
0
def mrna(s, r=1000000):
#    print [len(INV_CODON[x]) for x in chain(s, [STOP_VALUE])]
    return ro.prod_mod((len(INV_CODON[x]) for x in chain(s, [ro.STOP_VALUE])), r)
Пример #3
0
"""
============================================================
http://rosalind.info/problems/cunr

Given: A positive integer n (n<=1000).
Return: The total number of subsets of {1,2,...,n} modulo 1,000,000.
============================================================
"""
import rosalind.rosutil as ro

num_unrooted_trees = lambda n, r=1000000: ro.prod_mod(((2 * i - 1) for i in xrange(1, n - 1)), r)

if __name__ == "__main__":
    print num_unrooted_trees(ro.read_int("rosalind_cunr_sample.dat"))
    print num_unrooted_trees(ro.read_int("rosalind_cunr.dat"))