ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1132. Square Root

First of all, K is large but the range of n is small (<=32767 and is prime);
So we can process the query with same n at the same time.

And use brute-force method;

Note if there are solutions there are exacly two solutions.

x and n-x ((n-x)^2=x^2(mod n));
Can you explain me that better, I don't understand your idea.