首页 > [USACO 2007 Ope S]Catch That Cow
头像 savage
发表于 2019-08-12 16:02:35
题目描述 Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point on a number line 展开全文
头像 CH_cycyc
发表于 2025-01-11 07:02:45
链接:https://ac.nowcoder.com/acm/problem/25080 来源:牛客网 题目描述 Farmer John has been informed of the location of a fugitive cow and wants to 展开全文
头像 根据6
发表于 2024-03-31 12:18:20
空间复杂度O(1) 我们将原问题转换为在指定X*2操作次数计算下X+1和X-1操作的次数; 设X*2次数为opx,计算diff=abs(k*2^opx - n)。通过diff计算X+1和X-1的操作次数。 如果把X+1 X*2看成是X*2 X+2(单个操作加二),那么就可以利用二进制的特性快速求解。 展开全文