You are viewing a single comment's thread. Return to all comments →
from itertools import combinations N, string, K = int(input()), list(input().split()), int(input()) combs = list(combinations([i for i in range(N)], K)) tups = [p for p in combs if any(string[p[i]] == 'a' for i in range(K))] print(len(tups)/len(combs))
Seems like cookies are disabled on this browser, please enable them to open this website
Iterables and Iterators
You are viewing a single comment's thread. Return to all comments →