# 随机生成20内加减法import random
import string
#运行前调整文件目录
filed =open("F:\pycharm\dresult\problem.txt",'w+')
row =input('请输入行数:')
col =input('请输入列数:')
num1 =int(row)
num2 =int(col)
i =0
prob =[]
num = num1*num2
while i < num:
a = random.randint(1,19)
b = random.randint(1,19)
c = random.choice('+-')
d =str(a)+c+str(b)+'='if c =='+':if a+b >19or d in prob:passelse:
i = i+1
prob.append(d)else:if a <= b or d in prob:passelse:
i = i +1
prob.append(d)
i =1while i < num+1:print('%-27s'%prob[i-1],end='',file=filed)if i%3==0:print('\n',file=filed)else:pass
i = i+1
filed.close()