import sys try: def test(num,now,count): x=False temp=[] for i in now: if i+count==num or i-count==num: print(count) x= True break else: temp.append(i-count) temp.append(i+count) if x: return else: test(num,temp,count+1) while True: num = int(sys.stdin.readline().strip()) test(num,[0],1) except: pass
点赞 评论

相关推荐

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