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

Uncorrect
Posted by Alexander Kouprin 10 Mar 2007 01:50
I get AC, but I can't undestand this...

var k,p,x,y:int64;
begin
k:=1;
p:=3;
x:=0;
y:=2;
// Like a test #0 (sample)
if (x*x+y*y)=k mod p then writeln('correct test') else writeln('uncorrect test');
// x^2+y^2=k(mod p)
end.

So, anybody can tell me, why sample test is "uncorrect"?
Re: Uncorrect
Posted by Romko [Lviv NU] 10 Mar 2007 01:55

Because here can be many correct test, for example 0 1, 2 3 etc. So 1-st test is correct (0^2 + 2^2)mod 3 = 1(mod 3)
Re: Uncorrect
Posted by diver[rus] 10 Mar 2007 01:56
x^2+y^2 = k (mod p) mean in mathematics that (x^2 + y^2) mod p = k mod p