Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #https://inf-ege.sdamgia.ru/problem?id=59746
- def gen(s, k):
- global cnt
- if len(s) == k:
- if (int(s) % 5) == 0:
- cnt += 1
- return
- for nxt in range(10):
- if (len(s) == 0) and (nxt == 0):
- continue
- if str(nxt) not in s:
- gen(s + str(nxt), k)
- cnt = 0
- for i in range(1, 11):
- gen('', i)
- print(cnt + 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement