help with number theory problem

Правка en1, от hiddentesla, 2016-08-31 04:39:12

the problem: http://jollybeeoj.com/problem/view/255

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?

Теги number theory

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский hiddentesla 2016-08-31 04:39:12 287 Initial revision (published)