1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import sys def recur(a, b, length, total): global n, k if length == n: if total == k: print(”.join(arr)) exit() else: return if dp.get((a, b, length, total)) is None: dp[(a, b, length, total)] = True else: return arr[length] = ‘A’ recur(a + 1, b, length + 1, total) arr[length] = ‘B’ recur(a, b + 1, length + 1, total + a) arr[length] = ‘C’ recur(a, b, length + 1, total + a + b) n, k = map(int, sys.stdin.readline().rstrip().split()) dp = dict() arr = [0] * n recur(0, 0, 0, 0) print(–1) | cs |