天天看點

Quadratic equation(二次剩餘,闆子)

連結:https://ac.nowcoder.com/acm/contest/889/B

來源:牛客網

時間限制:C/C++ 2秒,其他語言4秒

空間限制:C/C++ 262144K,其他語言524288K

64bit IO Format: %lld

Amy asks Mr. B  problem B. Please help Mr. B to solve the following problem.

Let p = 1000000007.

Given two integers b and c, please find two integers x and y(0≤x≤y<p)(0 \leq x \leq y < p)(0≤x≤y<p), such that

(x+y) mod p=b(x + y) \bmod p = b(x+y)modp=b

(x×y) mod p=c(x \times y) \bmod p = c(x×y)modp=c

示例1

複制

添加新闆子闆子了......闆子又多又雜,沒有壞闆子,隻有自己沒寫好,碼力不強。