Блог пользователя Akshansh_01

Автор Akshansh_01, история, 20 месяцев назад, По-английски

Help me with this one!!! Whatever the logic I'm applying, time limit gets exceeded in the Test Case 4. This is my solution — https://codeforces.com/contest/1328/submission/167650940 I've tried without storing the values and directly printing it but the result was same — Time Limit Exceeded.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
20 месяцев назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

It's pretty easy: we have an integer a and we want to find out which another minimal integer we must add to a such that (a + x) % b == 0. let's look at a % b — if it equals to 0, we must add nothing, so just output 0. Else, we just add (b — a % b) and we're done.

167658837