pe705en

测试代码

def sort_count(li):
 le=len(li)
 c=0
 while True:
  c1=c
  for i in range(le-1):
   if li[i]>li[i+1]:
    li[i],li[i+1]=li[i+1],li[i]
    #print(li)
    c+=1
    break
  if c1==c:break  
 return c

def divide_seq(li):
 le=len(li)
 d=[]
 for i in range(le):
  d.append([])
  for j in range(1,li[i]+1):
   if li[i] % j ==0:
    d[i].append(j)
 return d

l20=[2,3,5,7,1,1,1,3,1,7,1,9]
def F():
 s=0
 for i in itertools.product(*divide_seq(l20)):s+=sort_count(list(i))
 print (s)


>>> F()
3312