Advertisement
magneto903

tour4_1_1

Jun 28th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. # квадрат выглядит как-то так
  2. #   1  2
  3. # 8      3
  4. #
  5. # 7      4
  6. #   6  5
  7. #
  8. arr = set()
  9.  
  10. for i in range(12345678, 87654322):
  11.     if len(set(str(i))) == 8 and '0' not in str(i) and '9' not in str(i):
  12.         group1 = sorted(list(map(int, str(i)[:2])))
  13.         group2 = sorted(list(map(int, str(i)[2:4])))
  14.         group3 = sorted(list(map(int, str(i)[4:6])))
  15.         group4 = sorted(list(map(int, str(i)[6:])))
  16.  
  17.         way = []
  18.         way.append(group1)
  19.         way.append(group2)
  20.         way.append(group3)
  21.         way.append(group4)
  22.  
  23.         way.sort()
  24.         way_str = ""
  25.         for j in range(len(way)):
  26.             way_str += ''.join(map(str, way[j]))
  27.  
  28.         #print(way_str)
  29.  
  30.         #break
  31.         arr.add(way_str)
  32.  
  33. arr = list(map(int, arr))
  34. print("Всего {} вариантов".format(len(arr)))
  35. print(sorted(arr))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement