Project Euler #240: Top Dice

  • + 0 comments

    Is it guranteed to be resolved in slow Python?

    See code below

    string = input()
    n, d, m, s = tuple(map(int, string.split()))
    
    x = [l for l in range(1,d+1)]
    m = m * (-1) - 1
    z = [p for p in itertools.product(x, repeat=n) if sum(sorted(p)[:m:-1]) == s]
    print(len(z) % (10**9+7))