[Python] ABC012 C

問題

C – 九九足し算

回答

N = int(input())

SUM_MULTIPLY = 2025
diff = SUM_MULTIPLY - N

ans_lst = []
for num in range(1, 10):
    if diff % num == 0 and diff / num < 10:
        str_mul = str(num) + ' x ' + str(int(diff/num))
        ans_lst.append(str_mul)

ans_lst.sort()

for ans in ans_lst:
    print(ans)