Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # квадрат выглядит как-то так
- # 1 2
- # 8 3
- #
- # 7 4
- # 6 5
- #
- arr = set()
- for i in range(12345678, 87654322):
- if len(set(str(i))) == 8 and '0' not in str(i) and '9' not in str(i):
- group1 = sorted(list(map(int, str(i)[:2])))
- group2 = sorted(list(map(int, str(i)[2:4])))
- group3 = sorted(list(map(int, str(i)[4:6])))
- group4 = sorted(list(map(int, str(i)[6:])))
- way = []
- way.append(group1)
- way.append(group2)
- way.append(group3)
- way.append(group4)
- way.sort()
- way_str = ""
- for j in range(len(way)):
- way_str += ''.join(map(str, way[j]))
- #print(way_str)
- #break
- arr.add(way_str)
- arr = list(map(int, arr))
- print("Всего {} вариантов".format(len(arr)))
- print(sorted(arr))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement