HELP in this number theory problem

Правка en1, от skmonir, 2018-05-18 14:52:13

Given two integers a and b (1 <= a, b <= 1e5). m = 1e9 + 7.

There will be up to 1e5 steps. In each step-
1. Multiply either a or b by c (1 <= c <= 1e5).
2. Find the value of (a % b) % m.

Note that, a or b may be changed after each step.

btw, it's not any OJ problem. I'm just interested about the solution.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский skmonir 2018-05-19 17:13:50 108 Tiny change: 'y a by c. And if t = 2 multiply ' -> 'y a by c. Else if t = 2, multiply '
en1 Английский skmonir 2018-05-18 14:52:13 369 Initial revision (published)