You are viewing a single comment's thread. Return to all comments →
from itertools import * r, x, l = int(input()), input().split(), int(input()) p = [i+1 for i in range(len(x)) if x[i] == 'a'] m = list(combinations(range(1,r+1),l)) seen = 0 for i in range(len(m)): for pair in m: for num in p: if num in pair: seen += 1 break break print(round(seen/len(m), 4))``
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 →