面试题 -算法?# Programming - 葵花宝典
N*Y
1 楼
面试题 - 算法?
input 4 positive integers p1, q1, p2, q2, where p1/q1 < p2/q2
output, positive integers p0 and q0
s.t. p1/q1 < p0/q0 and for any positive integer q, 0 < q < q0 and any integer p
either p/q < p1/q1 or p2/q2 < p/q
input 4 positive integers p1, q1, p2, q2, where p1/q1 < p2/q2
output, positive integers p0 and q0
s.t. p1/q1 < p0/q0
either p/q < p1/q1 or p2/q2 < p/q