wrong answer issue

Revision en1, by AnupamRoy, 2023-05-28 12:54:31

https://mirror.codeforces.com/problemset/problem/1175/A

for avobe problem as editorial the solution is here . but it gives worng answer what is the problem in my python code

for i in range(int(input())): n,m=map(int,input().split()) p=0 while 1: if n%m==0: n/=m n=int(n) p+=1 else: r=(n%m) n-=r p+=r if n==0: break print(p)

Tags python3

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English AnupamRoy 2023-05-28 12:54:31 488 Initial revision (published)