题解 | Old Bill

Old Bill

https://www.nowcoder.com/practice/17a30153e092493e8b4d13f321343927

def price(a, b, c, n):
    p = []
    di = []
    dj = []
    tag = 0
    for i in range(1, 10):
        for j in range(10):
            s = i * 10000 + a * 1000 + b * 100 + c * 10 + j
            if s % n == 0:
                di.append(i)
                dj.append(j)
                p.append(s)
                tag = 1
    if tag == 1:
        #return , di[-1], dj[-1]
        print("{} {} {}".format(di[-1], dj[-1], int(max(p)/ n)))
    else:
        print(0)

while True:
    try:
        n = int(input())
        a, b, c = map(int, input().split())
        price(a, b, c, n)
        
    except:
        break

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-25 13:59
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务