def GetMinCalculateCount(self, sourceX, sourceY, targetX, targetY) : # write code here if sourceX>targetX or sourceY > targetY: return -1 if sourceX==targetX and sourceY != targetY: return -1 if sourceX != targetX and sourceY == targetY: return -1 count = 0 while 2*sourceX<=targetX and 2*sourceY<=targetY and targetX-1>0 and targetY-1>0: if targetX%2==0 and targetY%2 == 0: targetX /= 2 targetY /= 2 count += 1 else: targetX -= 1 targetY -= 1 count += 1 if targetX - sourceX != targetY - sourceY: return -1 count += targetX-sourceX return count 要py2才能100, py3是50, 差点被坑了
1 2

相关推荐

09-20 22:39
中南大学
故事和酒66:意思就是用了AI辅助也不一定做得出来,还是有区分度,不然他不会让你用的
点赞 评论 收藏
分享
09-18 12:13
已编辑
门头沟学院 产品经理
火猴大圣:不要委屈自己,进去看一看 。。。 这样你才能彻底死心
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务