### DapSolve's blog

By DapSolve, history, 4 weeks ago, ,

can anyone explain solution to this problem link

• +4

 » 4 weeks ago, # |   +9 My solution : 1st case: x = 0 (mod k), we can find an easy solution: p = k and q = 0 2nd case: x != 0 (mod k): x = p * floor(x / k) + q * ceil(x / k) x = (p + q) floor(x / k) + q (ceil(x / k) - floor(x / k)) We have x mod k != 0 so ceil(x / k) - floor(x / k) = 1 Then, x = (p + q) floor(x / k) + q If we can find p and q such that: p + q = k and q = x % k, then we can find a solution because k * floor(x / k) + x % k = x => q = x % k and p = k - q (you can see that these values are solution for the first case also) 
•  » » 4 weeks ago, # ^ |   +10 RedStone Your Solution is so amaaaazing bro. it's so simple, thanks so much bro.