TheSleepyDevil's blog

By TheSleepyDevil, history, 5 months ago, In English

Given n , k , find the number of pairs (i,j) such that 0<=i<j<=n and k divides (j-i) Testcases up to 1e5 , (k<=n) up to 1e9 Sample:- input (5,2) , output 6

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By TheSleepyDevil, history, 7 months ago, In English

You Have Number N initialy equal to 1 , and there is 2 operations : 1) 1 x : multiple n by , n=n*x 2) 2 x : check if n%(x!)=0 , n mod (factorial x) = 0

Query up to 1e5 , x up to 1e6

Any hint ?

Full text and comments »

  • Vote: I like it
  • -11
  • Vote: I do not like it