fork(1) download
  1. a,m = map(int, input().split())
  2. b = []
  3. counter = 0
  4. while a != 0:
  5. b.append(a % m)
  6. a = int(a/m)
  7. counter += 1
  8. ([print(b[i], end=" ") for i in range(counter)])
Success #stdin #stdout 0.02s 9344KB
stdin
18 2
stdout
0 1 0 0 1