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 1066. Garland

So faint! I feel thrte is a O(1) algo & AC, but I don't understand, can someone tell me why?
Posted by wrbuaa2005 4 Sep 2008 18:19
After I get the function f(N)= N*N+a*N+(A-a-1), I solve f(a/2)=0 getting value of a, after that I find the two integar s1 s2 nearest to a and let f(s1) = 0 || f(s2) = 0 to min this function. An exception is a/2 > the N given by this problem, in this case it should be 0