Advertisement
Guest User

gówno nie interesuj się

a guest
Oct 20th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. import itertools
  2.  
  3. x = int(input("Podaj liczbe calkowita dodatnia do testu: ")) +1
  4.  
  5. listA = list(range(1,x))
  6. perm = itertools.permutations(listA)
  7.  
  8. for i in list(perm):
  9.     y = 0
  10.     for j in range(0,len(i)):
  11.         y += ((sum(i[0:j+1]) / (j+1) % 1 )==0)
  12.         if ((j+1) == len(i) and y == (j+1)):
  13.             print("znaleziono permutacje:" + str(i))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement