已知被除数b,商s和余数y ,求除数

输出一个整数。 如果无法算出,输出“no answer”

试试这样:

def sol(b,s,y):
    if b>=s  and b>y:
        x=(b-y)//s
        if x>y and s*x+y==b:
            print(x)
        else:
           print('no answer')
    else:
        print('no answer')
sol(16,3,1)

#5

用商乘以b,加上余数y就是除数。