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 1073. Square Country

solution
Posted by Cat36 28 Oct 2008 00:08
answer == 1  - manually
answer == 2  - manually
answer == 3  - n%8 !=7
else answer ==4
Re: solution
Posted by VakH 2 Feb 2009 20:39
and answer = 3 if ((N%32!=28)&&(N!=28))
good luck )
Re: solution
Posted by melkiy 7 Mar 2009 08:13
VakH wrote 2 February 2009 20:39
and answer = 3 if ((N%32!=28)&&(N!=28))

How did you derive this formula? I think it worked for you because of too little test numbers. In the analogous problem #1593  N<=10^15  your formula fails.

Nevertheless checking n=a^2+b^2 is at worst longer (O(sqrt(N)) than checking n=a^2+b^2+c^2 (log(N)).