python 取整itertools
1 #coding:utf-8 2 import sys 3 import itertools 4 5 def MaxString(n,nums): 6 7 list1 = nums 8 list2 = [] 9 for i in range(1, len(list1) + 1): 10 iter = itertools.combinations(list1, i) 11 m=list(iter) 12 k=len(m) 13 for j in range(k): 14 if sum(m[j])%n==0: 15 list2.append(m[j]) 16 print(list2) 17 k=len(list2[len(list2)-1]) 18 if k!=0: 19 print(k) 20 else: 21 print(0) 22 if __name__=='__main__': 23 a=int(input()) 24 b=[int(i) for i in sys.stdin.readline().split(' ')] 25 MaxString(a,b)