Success Rate 题目链接 题意 给你两个分数形式的数,然后有两种变化方式 上下都+1 仅下面部分+1 让你求第一个分数变化到第二个分数的最小步数. 思路 有几种特殊情况分类讨论一下. 首先我们先把右边化为最简比. 我们可以得到方程$$\frac{(x+a)}{(y+b)} = \frac{kp}{kq}$$ \[a = k*p - x\\b = k*q - y \] 根据\(b >= a\)可求得\(k = \frac{y-x}{q-p}\)向上取整,并且要求a>=0: 代码 #in…