Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import functools
- import math
- import itertools
- def findsubsets(s, n):
- return list(itertools.combinations(s, n))
- n = int(input())
- a = []
- for i in range(n):
- a.append(int(input()))
- b = []
- for i in range(1,n+1):
- temp = findsubsets(a,i)
- for e in temp:
- b.append(e)
- all_beauty = []
- for subs in b:
- if len(subs) > 0:
- s = sum(subs)
- r = functools.reduce(lambda x, y: x | y, subs)
- beauty = s/r
- all_beauty.append(beauty)
- ans = max(all_beauty)
- print(math.floor(ans*10000))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement