def zeby(l): string_num = "" nawias_holder = "" if l > 9: while l != 1: for i in range(9, 1, -1): if l % i == 0: string_num += str(i) + "[" nawias_holder += "]" l = int(l / i) if l == 1: break elif i == 2 and l % i != 0: l -= 1 string_num += "EC" string_num += "EC" + nawias_holder + "E" else: string_num += str(l) + "[EC]E" return string_num def prosta(l, s): string_num = "" nawias_holder = "" if l > 9: while l != 1: for i in range(9, 1, -1): if l % i == 0: string_num += str(i) + "[" nawias_holder += "]" l = int(l / i) if l == 1: break elif i == 2 and l % i != 0: l -= 1 string_num += s string_num += s + nawias_holder else: string_num += str(l) + "[" + s + "]" return string_num num = int(input()) result = "" for i in range(num): result += prosta(num - i, "A") result += zeby(num - i - 1) result += prosta(num, "C") print(result)
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | def zeby(l): string_num = "" nawias_holder = "" if l > 9: while l != 1: for i in range(9, 1, -1): if l % i == 0: string_num += str(i) + "[" nawias_holder += "]" l = int(l / i) if l == 1: break elif i == 2 and l % i != 0: l -= 1 string_num += "EC" string_num += "EC" + nawias_holder + "E" else: string_num += str(l) + "[EC]E" return string_num def prosta(l, s): string_num = "" nawias_holder = "" if l > 9: while l != 1: for i in range(9, 1, -1): if l % i == 0: string_num += str(i) + "[" nawias_holder += "]" l = int(l / i) if l == 1: break elif i == 2 and l % i != 0: l -= 1 string_num += s string_num += s + nawias_holder else: string_num += str(l) + "[" + s + "]" return string_num num = int(input()) result = "" for i in range(num): result += prosta(num - i, "A") result += zeby(num - i - 1) result += prosta(num, "C") print(result) |