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
点赞 评论

相关推荐

🎓学历背景:双非土木硕👨‍💻意向职位:AI应用开发大佬们可以帮我看看简历吗,秋招至今0offer
秋招结束再玩瓦:今年科班都不好找哇……你可以试试交叉岗,比如制造业国企的一些开发算法,或者互联网的边缘岗,it技术支持,运维这些
我的简历长这样
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务