Try precomputing the results for all possible a using mathematical
method, which should be O(N) (N=10^6) in total.
Then answer each query in O(1)  (there can be 100000 queries).

On Mar 26, 12:20 pm, saurabh singh <saurab...@gmail.com> wrote:
> I am very sorry but i dont think i got your point.You suggesting
> interpolation or some other technique?
> Kindly suggest some reference for good precomputation techniques......
> Thanks in advance
>
> --
> Saurabh Singh
> B.Tech (Computer Science)
> MNNIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to