题解:
1.已知n , 计算pq = n
题目中有条件 q − p ≤ λ ≤ 3 e 5 q-p \leq \lambda \leq 3e5 q−p≤λ≤3e5
于是假设 q = p + y q = p + y q=p+y
有 p q = p ( p + y ) = n pq = p(p+y) = n pq=p(p+y)=n
p = − y + y 2 + 4 n 2 p = \frac {-y+\sqrt{y^2 + 4n}}2 p=2−y+y2+4n
令 t = y 2 t = \frac y2 t=2y
则有 p = − t + t 2 + n p = -t + \sqrt{t^2 +n} p=−t+t2