base = 2 count = 0 while base < max(x, y): base *= 2 count += 1 result = 0 while base >= 2: if x <= base / 2 and y <= base / 2: result += 0 x = x y = y if x <= base / 2 and y > base / 2: result += a x = x y = y - 2 ** count if x > base / 2 and y <= base / 2: result += b x = x - 2 ** count y = y if x > base / 2 and y > base / 2: result += c x = x - 2 ** count y = y - 2 ** count base /= 2 count -= 1 print(result)
点赞 评论

相关推荐

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