Problem:


Score : 200 points

Problem Statement

Given is an integer N. Find the number of digits that N has in base K.

Notes

For information on base-K representation, see Positional notation - Wikipedia.

Constraints

All values in input are integers.

1 \leq N \leq 10^9

2 \leq K \leq 10

Input

Input is given from Standard Input in the following format:

N K

Output

Print the number of digits that N has in base K.

Sample Input 1

11 2

Sample Output 1

4

In binary, 11 is represented as 1011.

Sample Input 2

1010101 10

Sample Output 2

7

Sample Input 3

314159265 3

Sample Output 3

18



Sample input:
11 2


Sample output:
4

Submission status: Accepted

Solution code:
import math

N,K = map(int,input().split())

ans = math.log(N)//math.log(K)

print(int(ans+1))

Submission status: Accepted

Solution code:
N, K = [int(i) for i in input().split()]
for i in range(30, 0, -1):
    if(N//K**i >0):
        print(i+1)
        break
else:
    print(1)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
i = 1
while True :
    if N >= K**i:
        i += 1
    else:
        print(i)
        break

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
i = 1
while K**i <= N:
    i += 1
print(i)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
  
ans_N = Base_10_to_n(N, K)

print(len(list(str(ans_N))))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())


def convert(X, n):
    X_dumy = X
    out = ''
    while X_dumy > 0:
        out = str(X_dumy % n)+out
        X_dumy = int(X_dumy/n)
    return out


print(len(str(convert(N, K))))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
ans = 0
while (N > 0):
    N = N//K
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())

ans=1
while n//k>0:
    n//=k
    ans+=1

print(ans)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())

ans = 0
tent = 1

while tent <= n:
  ans += 1
  tent *= k
  
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy > 0:
        out = str(X_dumy % n)+out
        X_dumy = X_dumy//n
    return out


n, k = map(int, input().split())

print(len(Base_10_to_n(n, k)))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())

dig = 0
while True:
  if n >= pow(k,dig):
    dig += 1
  else:
    break
print(dig)

Submission status: Accepted

Solution code:
from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, K = read_int()

def solve():
    return rec(N)

def rec(n):
    if n < K:
        return 1
    return 1 + rec(n // K)

if __name__ == "__main__":
    print(solve())

Submission status: Accepted

Solution code:
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

N, K = map(int, input().split())
print( len(str(Base_10_to_n(N, K)) ))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())

ans = 0
while 1:
    ans += 1
    n //= k
    if n == 0:
        break
print(ans)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
cnt = 0
while N > 0:
    N //= K
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
ans = 0
while n != 0:
    n //= k
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
N,K = map(int, input().strip().split())

ans = 0
n = N
while n:
  n = n // K
  ans += 1
print(ans)

Submission status: Accepted

Solution code:
n,k = map(int, input().split())
x = 1
kari = k
while True:
    if n//kari >= 1:
        x += 1
        kari = k ** x
    else:
        print(x)
        quit()

Submission status: Accepted

Solution code:
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X % n)
    return str(X % n)


n, k = map(int, input().split())
x = Base_10_to_n(n, k)
print(len(x))

Submission status: Accepted

Solution code:
n,k = map(int,input().split())

ans = 0
while(n > 0):
    n //= k
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
ans = Base_10_to_n(n, k)
print(len(str(ans)))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())


def f(X, n):
    X_dumy = X
    out = ''
    while X_dumy > 0:
        out = str(X_dumy % n) + out
        X_dumy = int(X_dumy / n)
    return out


print(len(str(f(N, K))))

Submission status: Accepted

Solution code:
N, K = list(map(int, input().split()))

result = 1
while N:
    N //= K
    if 0<N:
        result += 1
    else:
        break

print(result)

Submission status: Accepted

Solution code:
n = list(map(int,input().split()))

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

tmp = Base_10_to_n(n[0], n[1])
print(len(tmp))

Submission status: Accepted

Solution code:
a,b = map(int,input().split())

c = 0
while a!=0:
    c+=1
    a=a//b
print(c)

Submission status: Accepted

Solution code:
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    #n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = [int(input()) for i in range(n)]
    #a = list(map(int, input().split()))
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0

    x10,x=map(int, input().split())
    x2 = Base_10_to_n(x10, x)
    print(len(x2))


    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N,K = input().split()
N = int(N)
K = int(K)

c=0
while N>=K:
    N = N//K
    c = c + 1

print(c+1)

Submission status: Accepted

Solution code:
N,K=list(map(int,input().split()))
out = ''
while N>0:
    out = str(N%K)+out
    N = int(N/K)
print(len(out))

Submission status: Accepted

Solution code:
N, K = [int(i) for i in input().split()]


i=0
while(N >= (K**i)):
    i=i+1

print(i)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

c = 1
while N >= K:
    N //= K
    c += 1

print(c)

Submission status: Accepted

Solution code:


N, K = map(int, input().split())

def func(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

print(len(str(func(N,K))))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out


def main():
    n, k = map(int, input().split())
    print(len(Base_10_to_n(n, k)))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
ans = 0
while N>=1:
  N/=K
  ans+=1
  
print(ans)

Submission status: Accepted

Solution code:
import math
N, K = map(int, input().split())
print(int(math.log(N, K))+1)

Submission status: Accepted

Solution code:
input = raw_input
n, k = map(int, input().split(" "))

import math
out = int(math.log(n, k)) + 1
print(out)

Submission status: Accepted

Solution code:
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N,K=input_int()

import math

print(int(math.log(N,K)+1))

Submission status: Accepted

Solution code:
n,k = map(int, input().split())
a = n
cnt = 1
while a>=k:
    a = a//k
    cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YNL = {False: 'No', True: 'Yes'}
YNU = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy > 0:
        out = str(X_dumy % n)+out
        X_dumy = int(X_dumy/n)
    return out


def main():
    N, K = MI()
    print(len(Base_10_to_n(N, K)))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial
from bisect import bisect_left # bisect_left(list, value)
#from fractions import gcd

sys.setrecursionlimit(10**7)
N, K = map(int, input().split())


for k in range(1, 1000):
    if N < K**(k):
        print(k)
        exit()

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
def bb(X, n):
    if (int(X/n)):
        return bb(int(X/n), n)+str(X%n)
    return str(X%n)
a=bb(n,k)
print(len(a))

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
a=0
while n:
  n=n//k
  a+=1
print(a)

Submission status: Accepted

Solution code:
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

if __name__=="__main__":
    n,k=map(int,input().split())
    ans=Base_10_to_n(n,k)
    print(len(ans))

Submission status: Accepted

Solution code:
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
def resolve():
    N, K = map(int, input().split())
    print(len(Base_10_to_n(N, K)))
resolve()

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

print(len(str(Base_10_to_n(N, K))))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,K=map(int,input().split())
    ans=0
    a=1
    N+=1
    while N>a:
        a*=K
        ans+=1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, k = (int(i) for i in input().split())

def Base_10_to_n(X, n):
    if (int(X / n)):
        return Base_10_to_n(int(X / n), n) + str(X % n)
    return str(X % n)
ans = Base_10_to_n(n, k)
print(len(ans))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

n, k = [int(item) for item in input().split()]

cnt = 0
while n > 0:
    n //= k
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

ans = 1
max_K = K

while N >= max_K:
    ans += 1
    max_K *= K

print(ans)

Submission status: Accepted

Solution code:
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X % n)
    return str(X % n)


n, k = map(int, input().split())


print(len(Base_10_to_n(n, k)))

Submission status: Accepted

Solution code:
n, k = map(int, (input().split()))

d = 1
k2 = k
while True:
    if n < k2:
        print(d)
        exit()
    else:
        d += 1
        k2 *= k

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
ans = 0
while n >= k**ans:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
n,k = input().split()
k  = int(k)

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
ans = len(str(Base_10_to_n(int(n),k)))
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N, K = map(int, input().split())

ans = 1
while N >= K:
    ans += 1
    N //= K

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N, K = map(int, input().split())

ans = 0
while N > 0:
    N //= K
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
a,b=list(map(int, input().split()))
from math import log
if True:
  print(int(log(a,b)+1))

Submission status: Accepted

Solution code:
import string
numbers = "0123456789"
alphabets = string.ascii_letters # a-z+A-Zをロード
characters = numbers + alphabets

def base_cvt(value, n=2):
    try:
        tmp = int(value)
    except:
        raise ValueError('Invalid value:', value)
 
    if n < 2 or n > len(characters):
        raise ValueError('Invalid n:', value)
 
    result = ''
    tmp = int(value)
    while tmp >= n:
        idx = tmp%n
        result = characters[idx] + result
        tmp = int(tmp / n)
    idx = tmp%n
    result = characters[idx] + result
    return result

def main():
    n, k = map(int, input().split())

    ans = len(base_cvt(n,k))
    
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
cnt = 0
while k ** cnt <= n:
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

n,k=map(int,input().split())
cnt=0
while n:
    n//=k
    cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
N, K = map(int,input().split())

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

ans = Base_10_to_n(N, K)
print(len(ans))

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
a=1
c=0
while a<=n:
    a*=k
    c+=1
print(c)

Submission status: Accepted

Solution code:
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    #n=int(input())
    n,k= map(int, sys.stdin.readline().split(' '))
    v=1
    ans=1
    while(v<=n):
        v*=k
        ans+=1
    print(ans-1)
    #a=list(map(int,sys.stdin.readline().split(' ')))
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

Submission status: Accepted

Solution code:
n, k = map(int, input().split())

def sinsuu(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
 
ans = sinsuu(n,k)
print( len(ans) )

Submission status: Accepted

Solution code:
N, K=map(int, input().split())
ans=0
while N>0:
    N=N//K
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
cnt=0
while 1:
    if n//k==0:break
    else:
        n /=k
        cnt +=1
print(cnt+1 if n!=0 else cnt)

Submission status: Accepted

Solution code:
#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N
#math.ceilで切り上げ
#dp = [[0] * 4 for i in range(3)] #2次元配列初期化
#dp = [[[0] * 2 for i in range(3)] for j in range(5)]
#(ord('A'))でASCII出力 Aは65
import math
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

n, k = splitintinput()
for i in range(10000):
    if n < k ** i:
        print(i)
        break

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

res = 0
for _ in range(100):
    N = N // K
    res += 1
    if N == 0:
        break

print(res)

Submission status: Accepted

Solution code:
n,k = [int(x) for x in input().split()]

def f(X, n):
    if (int(X/n)):
        return f(int(X/n), n)+str(X%n)
    return str(X%n)

num = f(n,k)

print(len(str(num)))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
ans = 0
while N > 0:
    N = N//K
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
N,K = list(map(int, input().split(' ')))
keta = 0
while(N>0):
    N = N//K
    keta+=1

print(keta)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
ans = 0
while N:
    ans += 1
    N //= K
print(ans)

Submission status: Accepted

Solution code:
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)


def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X % n)
    return str(X % n)


N, K = map(int, input().split())
ans = Base_10_to_n(N, K)
print(len(ans))

Submission status: Accepted

Solution code:
import math
N, K = map(int, input().split())


print(int(math.log(N, K)) + 1)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())

def Base_10_to_n(X, n):
  X_dumy = X
  out = ''
  while X_dumy>0:
    out = str(X_dumy%n)+out
    X_dumy = int(X_dumy/n)
  return out

print(len(str(Base_10_to_n(n, k))))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

ans = 1

while N >= K:
    N = N // K
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys


def main(S):
    pass


if __name__ == '__main__':
    n, r = map(int, input().split())

    i = 0
    while (n > 0):
        i += 1
        n = n // r
    print(i)

Submission status: Accepted

Solution code:
n, k = map(int,input().split())
bi=''
while n!=0:
    bi+=str(n%abs(k))
    if k<0:n=-(-n//k)
    else:n=n//k
print(len(bi[::-1]))

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
for i in range(1000000):
  if k**i > n:
    print(i)
    break

Submission status: Accepted

Solution code:
from math import log
def main():
    N, K = map(int, input().split())
    print(int(log(N, K) + 1))

main()

Submission status: Accepted

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

def main():
  n,k=LI()
  ans=Base_10_to_n(n,k)
  return len(str(ans))

# main()
print(main())

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N, K = LI()
    cnt = 0
    while N:
        N = N//K
        cnt += 1
    print(cnt)
main()

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
ans = 0
now = 1
while True:
  if n < now:
    print(ans)
    break
  ans += 1
  now *= k

Submission status: Accepted

Solution code:
n, k = [int(_) for _ in input().split()]

i = 0
while True:
    if k**i > n:
        break
    i += 1

print(i)

Submission status: Accepted

Solution code:
# ABC156b


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと

    n, k = map(int, input().split())
    ans = []
    for i in range(30, -1, -1):
        t = n//k**i
        if len(ans) == 0 and t == 0:
            continue
        ans.append(t)
        n = n-k**i*t
    print(len(ans))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

result = 0
while N > 0:
    N //= K
    result += 1

print(result)

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
import math
print(math.floor(math.log(N,K))+1)

Submission status: Accepted

Solution code:
# Python3 Program to convert decimal to 
# any given base 

# To return char for a value. For example 
# '2' is returned for 2. 'A' is returned 
# for 10. 'B' for 11 
def reVal(num): 

    if (num >= 0 and num <= 9): 
        return chr(num + ord('0')); 
    else: 
        return chr(num - 10 + ord('A')); 

# Utility function to reverse a string 
def strev(str): 

    len = len(str); 
    for i in range(int(len / 2)): 
        temp = str[i]; 
        str[i] = str[len - i - 1]; 
        str[len - i - 1] = temp; 

# Function to convert a given decimal 
# number to a base 'base' and 
def fromDeci(res, base, inputNum): 

    index = 0; # Initialize index of result 

    # Convert input number is given base 
    # by repeatedly dividing it by base 
    # and taking remainder 
    while (inputNum > 0): 
        res+= reVal(inputNum % base); 
        inputNum = int(inputNum / base); 

    # Reverse the result 
    res = res[::-1]; 

    return res; 

# Driver Code 
inputNum,base = map(int,input().split()) 
res = ""; 
print(len(str(fromDeci(res, base, inputNum)))) 

# This code is contributed by mits

Submission status: Accepted

Solution code:
import math

n, k = map(int, input().split())
print(math.floor(math.log(n, k)+1))

Submission status: Accepted

Solution code:
import math

N, K = [int(i) for i in input().split()]

print(int(math.log(N, K))+1)

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
c = 0
while(n!=0):
    n = n//k
    c+=1
print(c)

Submission status: Accepted

Solution code:
ans=0
n,k=map(int,input().split())
while True:
    n=n//k
    ans+=1
    if n==0:
        break
print(ans)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())

ans=0

while n>0:
    ans+=1
    n=n//k

print(ans)

Submission status: Accepted

Solution code:
#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

l = list(map(int, input().split()))

cnt =1
while l[0]>=l[1]:
    l[0]/=l[1]
    cnt +=1
print(cnt)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())

cnt = 0
while(N>0):
    N -= N%(K**cnt)
    cnt += 1


print(cnt-1)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())

for i in range(100):
    if k ** i <= n < k ** (i+1):
        break
print(i + 1)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())

ans = 0
while N > 0:
    N //= K
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, K = iim()
    i = 0
    while N:
        N //= K
        i += 1
    print(i)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
n,k=map(int,input().split())

ans=0
for i in range(10**12):
  if n<k**i:
    ans=i-1
    break
print(ans+1)

Submission status: Accepted

Solution code:
import sys
import math
import collections
#n = int(input())
n, k = map(int, input().split())
#s = input()
#a = list(map(int, input().split()))

p = 1
while (True):
  q = k ** p
  if q > n:
    print(p)
    break
  p += 1

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
ans = 0
for i in range(100):
    n //= k
    if n > 0:
        ans += 1
    else:break
print(ans+1)

Submission status: Accepted

Solution code:
import numpy as np

N, K = list(map(int, input().split()))

logK_N = np.log2(N) / np.log2(K)
print(int(logK_N) + 1)

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
count=0
while N!=0:
    N=N//K
    count+=1
print(count)

Submission status: Accepted

Solution code:
N, K = map(int,input().split())
res = 0
while N>=1:
    N = N//K
    res += 1
print(res)

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
i=0
while True:
    if (pow(K,i)<=N)and(N<pow(K,i+1)):
        break
    else:
        i=i+1
print(i+1)

Submission status: Accepted

Solution code:
n, k = list(map(int, input().split()))

digit = 0

while n > 0:
    digit += 1
    n = n // k

print(digit)

Submission status: Accepted

Solution code:
import sys

def base_convert(n, b):
    res = ''
    q = n
    while q:
        q, r = divmod(q, b)
        if r < 0: 
            q += 1
            r -= b
        res = str(r) + res

    return int(res) if res else 0

n, k = map(int, sys.stdin.readline().split())

def main():
    return len(str(base_convert(n, k)))

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

Solution code:
N, K = [int(i) for i in input().split()]

import string

numbers = "0123456789"
alphabets = string.ascii_letters # a-z+A-Zをロード
characters = numbers + alphabets

def base_cvt(value, n=2):
    try:
        tmp = int(value)
    except:
        raise ValueError('Invalid value:', value)

    if n < 2 or n > len(characters):
        raise ValueError('Invalid n:', value)

    result = ''
    tmp = int(value)
    while tmp >= n:
        idx = tmp%n
        result = characters[idx] + result
        tmp = int(tmp / n)
    idx = tmp%n
    result = characters[idx] + result
    return result

print(len(base_cvt(N, K)))

Submission status: Accepted

Solution code:
def I(): return int(input())
def MI(): return map(int, input().split())
def LMI(): return list(map(int, input().split()))


N, K = MI()
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
print(len(Base_10_to_n(N, K)))

Submission status: Accepted

Solution code:
n,k = map(int,input().split())

i = 0
while n>0:
  i+=1
  n//=k

print(i)

Submission status: Accepted

Solution code:
#!/usr/bin/env python

from collections import deque, defaultdict
import itertools as ite
import sys
import math
from decimal import *

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = map(int, raw_input().split())
cnt = 0
while N > 0:
    N /= K
    cnt += 1
print cnt

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, K: int):
    def f(x: int, k: int):
        if x < k:
            return 1
        
        return 1+f(x//k, k)

    print(f(N, K))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,k = map(int,input().split())

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

ans = Base_10_to_n(n,k)
print(len(ans))

Submission status: Accepted

Solution code:
n,k = map(int, input().split())
ans = 0
while n>0:
    n = n//k
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
import math

N, K = list(map(int, input().split()))

print(int(math.log(N, K) + 1))

Submission status: Accepted

Solution code:
N,K=map(int, input().split())

cnt=0
while N>=K:
  N/=K
  cnt+=1
  
print(cnt+1)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
ans = ""
while True:
    ans = ans+str(n % k)
    n = n//k
    if n == 0:
        break
print(len(ans))

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
ans=1
while n>=k:
    n=(n-n%k)//k
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
N,K = list(map(int, input().split()))

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

print(len(Base_10_to_n(N,K)))

Submission status: Accepted

Solution code:
N,K = map(int,input().split())

ans = 0
while N > 0:
    N = N//K
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key


yn = 'YNeos'
ynflg = False
cnt = 0
ans = None

def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

def mulinputs():
    return map(int,input().split())

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas



N, K = mulinputs()





# 出力
print(floor(log2(N)/log2(K))+1)

Submission status: Accepted

Solution code:
#coding:utf-8
import sys,os
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    N,K = LMIIS()
    ans = 0
    while N > 0:
        N //= K
        ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, k = map(int, input().split())

count = 1

while n >= k:
    n //= k
    count += 1

print(count)