You are viewing a single comment's thread. Return to all comments →
def dp(a,b,e): for i in range(1,b+1): g=a+9*(10**i) if g%e==0: return g ans=dp(g,i-1,e) if ans!=0: return ans return 0 def solve(n): if n%2==0 or n%5==0: a=90 b=0 while True: if a%n==0: return str(a) ans=dp(a,b,n) if ans==0: a*=10 b+=1 else: return str(ans) else: a=90 b=0 if 9%n==0: return "9" while True: if (a+9)%n==0: return str(a+9) ans=dp(a+9,b,n) if ans==0: a*=10 b+=1 else: return str(ans)
Seems like cookies are disabled on this browser, please enable them to open this website
Special Multiple
You are viewing a single comment's thread. Return to all comments →