Advertisement
biswasrohit20

sub

May 9th, 2021
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import functools
  2. import math
  3. import itertools
  4.  
  5.  
  6. def findsubsets(s, n):
  7. return list(itertools.combinations(s, n))
  8.  
  9.  
  10. n = int(input())
  11. a = []
  12. for i in range(n):
  13. a.append(int(input()))
  14.  
  15. b = []
  16. for i in range(1,n+1):
  17. temp = findsubsets(a,i)
  18. for e in temp:
  19. b.append(e)
  20.  
  21. all_beauty = []
  22.  
  23. for subs in b:
  24. if len(subs) > 0:
  25. s = sum(subs)
  26. r = functools.reduce(lambda x, y: x | y, subs)
  27. beauty = s/r
  28. all_beauty.append(beauty)
  29.  
  30. ans = max(all_beauty)
  31. print(math.floor(ans*10000))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement