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 1375. Bill Clevers

It is useful for you...
Posted by Adhambek 4 Jan 2014 13:43
x^2 + y^2 = A * p + k;
you use this simple algorithm:
A = [0....p]
and simple Check:
first time : y = 0 and x = sqrt(A*p + k)
if(x*x == A*p + k) you should Print this answer: x and y
else
second time: x = (int) sqrt(A*p + k) and y = sqrt(A*p + k - (int)x*x)
if(x*x + y*y == A*p + k) you should Print this answer : x and y
else continue and increasing only ONE count of A

Sorry my English...

Edited by author 04.01.2014 13:44

Edited by author 26.05.2014 22:39
Re: It is useful for you...
Posted by Adhambek 26 May 2014 22:39
x  and  y  are INTEGER....