|
|
вернуться в форумI can have my program solve it in sqrt(n) but this is not good enough. Please tell me how to optimize. 10x in advance As I guess, your O(sqrt(n)) time is from finding ap+bq=1 , right? If so , you can use extended Euclidean algorithm (one which find GCD) to solve this equation. Right! I got AC! (the GCD of p and q is 1!!!!!!!) |
|
|