help with number theory problem

Revision en1, by hiddentesla, 2016-08-31 04:39:12

the problem:

i tried all i can, but i can only think of preprocessing and save it in a string, then output the questions in O(1), but sadly, i cant because its memory limit exceeded, is there a math based approach?

Tags number theory


  Rev. Lang. By When Δ Comment
en1 English hiddentesla 2016-08-31 04:39:12 287 Initial revision (published)