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
import fractions

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p
'''
p = 10 ** 9 + 7
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)
    
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p
'''


#a = list(map(int, input().split()))

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

count = 0
now = 1
for i in range(99999):
    if(now<=n):
        now*=k
        count+=1
    else:
        break
        
print(count)

Submission status: Accepted

Solution code:
import numpy as np

N, K = map(int, input().split())
L = np.array([])
while N > 0:
  L = np.append(L, N%K)
  N /= K
  N = np.floor(N)
  
print(len(L))

Submission status: Accepted

Solution code:
l1 = input()
l1 = l1.split()
N = int(l1[0])
K = int(l1[1])
ans = 0

while True:
    q, mod = divmod(N, K)
    N = q
    ans += 1

    if q <= 0:
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import string
numbers = "0123456789"
alphabets = string.ascii_letters
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(' '))

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

    return 0


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
p = 1
check = K
while N >= check:
  p += 1
  check += (K-1)*K**(p-1)
print(p)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from functools import *
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def Golf():
    *a,=map(int,open(0))
def S_():
    return input()
def IS():
    return input().split()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[1]*(w+2)
    found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['YES','NO']
Yn=['Yes','No']

mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
#ts=time.time()
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()
 
def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

class Comb:
    def __init__(self,n,mo=10**9+7):
        self.fac=[0]*(n+1)
        self.inv=[1]*(n+1)
        self.fac[0]=1
        self.fact(n)
        for i in range(1,n+1):
            self.fac[i]=i*self.fac[i-1]%mo
            self.inv[n]*=i
            self.inv[n]%=mo
        self.inv[n]=pow(self.inv[n],mo-2,mo)
        for i in range(1,n):
            self.inv[n-i]=self.inv[n-i+1]*(n-i+1)%mo
        return
    
    def fact(self,n):
        return self.fac[n]
        
    def invf(self,n):
        return self.inv[n]

    def comb(self,x,y):
        if y<0 or y>x:
            return 0
        return self.fac[x]*self.inv[x-y]*self.inv[y]%mo


show_flg=False
show_flg=True

ans=0

N,K=LI()
def keta(n,k):
    t=1
    for i in range(100):
        t*=k
        if n<t:
            return i+1
ans=keta(N,K)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N, K = map(int, input().split())
num = 1
bor = K
while  True:
    if N < bor:
        print(num)
        break
    else:
        num = num + 1
        bor = bor * K

Submission status: Accepted

Solution code:
i = list(map(int, input().split()))
N=i[0]
K=i[1]
def abc(N,K,x):
    if N-(K**x)>=0:
      abc(N,K,x+1)
    else:
        print(x)
abc(N,K,1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import string

numbers = "0123456789"
alphabets = string.ascii_letters
characters = numbers + alphabets


def convert(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(' '))

    after = convert(n, k)
    print(len(after))

    return 0


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin


def rec(n, k, cnt):
    if n < k:
        return cnt + 1
    else:
        q, mod = divmod(n, k)
        cnt += 1
        n = q
        return rec(n, k, cnt)


def main():
    N, K = [int(x) for x in stdin.read().rstrip().split()]
    print(rec(N, K, 0))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

digit = 0

while K**digit <= N:
    digit += 1

print(digit)

Submission status: Accepted

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

Submission status: Accepted

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

i = 1
while(n >= k):
    n = n // k
    i = i + 1

print(i)

Submission status: Accepted

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

for i in itertools.count(0):
  if N//(K**i)<K:
    print(i+1)
    break

Submission status: Accepted

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

Submission status: Accepted

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

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

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(Base_10_to_n(n, k))
print(len(Base_10_to_n(n, k)))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
def toStr(n, base):
    convertString = "0123456789ABCDEF"
    if n < base:
        return convertString[n]
    else:
        return toStr(n // base, base) + convertString[n % base]


N, K = input().split()
print(len(toStr(int(N), int(K))))

Submission status: Accepted

Solution code:
def keisan2(n,k,depth):
    n = n//k
    if n == 1:
        return depth+1
    elif n == 0:
        return depth
    else:
        return keisan2(n,k,depth+1)
n,k = map(int,input().split())
print(keisan2(n,k,1))

Submission status: Accepted

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

Submission status: Accepted

Solution code:


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

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

Submission status: Accepted

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

for i in range(0,1000):
  if k**i <= n < k**(i+1):
    print(i+1)

Submission status: Accepted

Solution code:
import math

num, base = input().split(' ')
print(int(math.log(int(num), int(base)) + 1))

Submission status: Accepted

Solution code:
import math

N, R = map(int, input().split())
X = math.log(N + 0.000001, R)
Y = math.ceil(X)

print(Y)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
cnt=0
while(n>1):
    cnt+=1
    n=n//k
if n>=1:
    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 = len(Base_10_to_n(n, k))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
a=0
for i in range(10000000):
    a+=1
    if N<(K**i):
        break
print(a-1)

Submission status: Accepted

Solution code:
N,K = map(int, input().split())
A = 1
k = K
while N+1 > k:
    k = k * K
    A = A+1
print(A)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
a = raw_input()
n = int(a.split(" ")[0])
k = int(a.split(" ")[1])

def toStr(n,base):
   convertString = "0123456789ABCDEF"
   if n < base:
      return convertString[n]
   else:
      return toStr(n//base,base) + convertString[n%base]

res = toStr(n,k)
print(len(str(res)))

Submission status: Accepted

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

cnt = 0
while n!=0:
  n = int(n/float(k))
  cnt += 1
  
print(cnt)

Submission status: Accepted

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

import sys
from collections import deque as deq

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

R = 0

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

print(R + 1)

Submission status: Accepted

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

x10 = 35
x2 = Base_10_to_n(N, K)
x2 = str(x2)
print(len(x2))

Submission status: Accepted

Solution code:
import math

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

a = int(math.log(n, k))

for i in range(a + 2):
    if n < k**i:
        print(i)

Submission status: Accepted

Solution code:
import math

def resolve():
    N,K=map(int,input().split())
    A=math.log(N,K)
    if N==1:
      print(1)
      return
    print(math.ceil(A))




if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
nk =  list(map(int, input().split()))
a = nk[0]
count = 1

while a/nk[1] >= nk[1] :

    a=a/nk[1]

    count+=1

if count > 1:
    count+=1

print(count)

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())

a = []
while True:
  if n < 1:
    break
  a.append(n%k)
  n //= k

print(len(a))

Submission status: Accepted

Solution code:
s = input().split()

n = int(s[0])
k = int(s[1])
cnt = 1

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

print(cnt)

Submission status: Accepted

Solution code:
n,k=[int(i) for i in input().split()]
ans=0
while n>0:
    n//=k
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
NK = input().split()

N = int(NK[0])
K = int(NK[1])

ans = 1
while True:
    if N >= K**ans:
        ans += 1
    else:
        break
print(ans)

Submission status: Accepted

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

while 1:
  if n <= k**i - 1:
    print(i)
    exit()
  i += 1

Submission status: Accepted

Solution code:

X,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)

res=(Base_10_to_n(X,n))
print(len(res))

Submission status: Accepted

Solution code:
import math

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

if float.is_integer(math.log(n, k)):
    print(math.ceil(math.log(n, k))+1)
else:
    print(math.ceil(math.log(n, k)))

Submission status: Accepted

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

total = 0

while True:
    if N < K:
        total += 1
        break
    else:
        N, m = divmod(N, K)
        total += 1
       
print(total)

Submission status: Accepted

Solution code:
N,R = 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

x10 = N
x2 = Base_10_to_n(x10, R)
print(len(x2))

Submission status: Accepted

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


n = 1
while True:
    if  K** (n-1) <= N < K**n:
        break
    else:
        n += 1
print(n)

Submission status: Accepted

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

Submission status: Accepted

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

count = 1
while True:
    if n / k >= 1:
        n  = int(n / k)
        count += 1
    else:
        break

print(count)

Submission status: Accepted

Solution code:
def toStr(n,base):
  convertString = "0123455789ABCDEF"
  if n<base:
    return convertString[n]
  else:
    return toStr(n//base,base)+ convertString[n%base]
a,b = map(int,input().split())
print(len(toStr(a,b)))

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()) 
if N==1:
  print(1)
else:
  print(math.ceil(math.log(N, K)))

Submission status: Accepted

Solution code:
import math
def f(x, n):
    if x//n:
        return f(x//n, n) + str(x%n)
    return str(x%n)
n, k = map(int, input().split())
print(len(f(n, k)))

Submission status: Accepted

Solution code:
from math import floor
N, K = list(map(int, input().split()))
x = 0
while N > 0:
    if (N/K) < 0:
        break
    else:
        N = floor(N/K)
        x += 1

print(x)

Submission status: Accepted

Solution code:
result = ""
i = input().split()
n = int(i[0])
b = int(i[1])
while n > 0:
    result = str(n%b) + result
    n = n//b


print(len(result))

Submission status: Accepted

Solution code:
n, k = (int(x) for x in input().split())
ans = 1
tmp = 0
while True:
    tmp = k ** ans - 1
    if n <= tmp:
        break
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
import math
 
n, k = [int(i) for i in input().split()]
 
tmp = math.log(n, k)
result = int(tmp)


print(result+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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input = 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
x10 = int(input[0])
xn = Base_10_to_n(x10, int(input[1]))
print(len(xn))

Submission status: Accepted

Solution code:
a, b = 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(a, b)))

Submission status: Accepted

Solution code:
from math import log10
n,k = map(int,input().split())
print(int(log10(n)/log10(k))+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

s = input().split()
n = int(s[0])
k = int(s[1])

c =0
while n>(k-1):
    a = n%k
    n = (n-a)/k
    c += 1
print(c+1)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, n = map(int, input().split())
cnt = 0
nn = 1
while True:
    cnt += 1
    nn *= n
    if a < nn:
        break
print(cnt)

Submission status: Accepted

Solution code:
input_arr = input().split(" ")
n = int(input_arr[0])
k = int(input_arr[1])

ans = ""

num = n
while(num > 0):
    ans += str(num % k)
    num //= k

print(len(ans))

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:
n, k = map(int, input().split())
_k = k
ans = 1
while n >= _k:
    _k *= k
    ans += 1
print(ans)

Submission status: Accepted

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

for i in range(1, 10 ** 10):
  if N < (K ** i):
    print(i)
    break

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
cnt = 0
val = k
for i in range(n):
    if val > n:
        break
    val *= k
    cnt += 1
    #print(k)
    #print(val)
    if val > n:
        break
    #print(cnt)
    #print(i)
    #print(val)
print(cnt+1)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
def solve_digits(N, K):
	res = ''
	while N > 0:
		res += str(N % K)
		N = N // K
	return res

print(len(solve_digits(N, K)))

Submission status: Accepted

Solution code:
import math
N, K = list(map(int, input().split()))
buf = []
while(N != 0):
    buf.insert(0, str(N % K))
    N = math.floor(N / K)
print(len(buf))

Submission status: Accepted

Solution code:
n,k = map(int, input().split())
if n==0:
  print('0')
else:
  char='0123456789'
  result=''
  i=0
  while(n>0):
    result=char[n%k]+result
    n=n//k
    i=i+1
  print(i)

Submission status: Accepted

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

qs = []

q,mod = divmod(N,K)
qs.append(mod)
while q != 0:
    q,mod = divmod(q,K)
    qs.append(mod)
    
print(len(qs))

Submission status: Accepted

Solution code:
import math

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

while True:
  n = math.floor(n/k)
  digits += 1
  if n == 0:
      break
  
print(digits)

Submission status: Accepted

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

sum = 0
for i in range(0, 10**9):
    sum += pow(K, i) * (K - 1)
    if (sum >= N):
        print(i + 1)
        break

Submission status: Accepted

Solution code:
s=input().split()
n=int(s[0])
k=int(s[1])
keta=1
while n/k >= 1:
  keta+=1
  n=int(n/k)
print(keta)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
c=1
d=0
while 1:
  
  
  if a-c<0:
    break
  d+=1
  c*=b
  
print(d)

Submission status: Accepted

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

x = 0

for j in range(1, 46):
    if N >= (K**j):
        continue
    else:
        print(j)
        break

Submission status: Accepted

Solution code:
import math

S, T=map(int, input().split())

ans=math.floor(math.log(S, T))+1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 24 14:37:00 2020

@author: matsui
"""

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

for i in range(31):
    if K**i > N:
        ans=i
        break

print(ans)

Submission status: Accepted

Solution code:
N=input().split()
A=int(N[0])
B=int(N[1])
c=0
while A >= B:
  A=A//B
  c+=1
  
c=c+1
print(c)

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=map(int, input().split())  
x=N
ans = []
while x>0:
  ans.append(x%K)
  x = x//K
  #print(x%K)
print(len(ans))

Submission status: Accepted

Solution code:
def ten_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 = [int(_) for _ in input().split()]
    ans = ten_to_n(N, K)
    print(len(ans))
main()

Submission status: Accepted

Solution code:
import numpy as np

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

string_N = str(np.base_repr(n, k))

print(len(string_N))

Submission status: Accepted

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

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

hennkan = sisuu(N, K)
ketasuu = len(str(hennkan))

print(ketasuu)

Submission status: Accepted

Solution code:
data = list(map(int, input().split()))
n = data[0]
k = data[1]


digit = 1
while True:
    if n < k:
        print(digit)
        exit()
    n = n / k
    digit += 1
    if n < k:
        print(digit)
        exit()

Submission status: Accepted

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

a = True
remain = N
dir_list = []

while a:
    if  remain // k > 0:
        dir_list.append(remain)
        remain = remain // k
    else:
        a = False

print(len(dir_list)+1)

Submission status: Accepted

Solution code:
import math
n,k = map(int,input().split())
count = 0
if n == 1:
	print(1)
else:
	count = math.ceil(math.log(n,k))
	print(count)

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:
N,K=map(int, input().split())
n=0
while N>=1:
  N=N/K
  n=n+1
print(n)

Submission status: Accepted

Solution code:
#python3
def main():
    n, k = map(int, input().split())
    i = 0
    while n:
        n = n//k
        i+=1
    print(i)
main()

Submission status: Accepted

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


def main():
    B = list(map(int, input().split()))
    #     # # [1,2,3]
    res = Ten_to_n(B[0], B[1])
    print(len(res))


main()

Submission status: Accepted

Solution code:
def calc(N, n):
    res = 0
    while N > 0:
        res += 1
        N //= n
    return res
    
if __name__ == '__main__':
    k, R = map(int, input().split())
    print(calc(k, R))

Submission status: Accepted

Solution code:
n,sin=map(int,input().split(' '))
ls=[]
while n>=sin:
    ls.append(n%sin)
    n=n//sin
ls.append(n)

print(len(ls))

Submission status: Accepted

Solution code:
n, k = list(map(int, input().split(" ")))
result = ""
while n >= k:
  result = str(n % k) + result
  n = int(n / k)
result = str(n % k) + result
print(len(result))

Submission status: Accepted

Solution code:
import math

line=list(map(int,input().split()))
a=line[0]
b=line[1]

n=1+math.log(a,b)
print(math.floor(n))

Submission status: Accepted

Solution code:
import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools

mod = int(1e9+7)
INF = 1<<29

def main():
    n,k = map(int,input().split())
    ans = 1
    while k ** ans <= n:
        ans += 1
    print(ans)
    return

if __name__=='__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n,k=map(int,input().split())
t=math.log(n,k)

print(int(t)+1)

Submission status: Accepted

Solution code:
X, n = 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)

x10 = X 
x2 = Base_10_to_n(x10, n)
print(len(x2))

Submission status: Accepted

Solution code:

import math

n, k = map(lambda x: int(x), input().split())


tst = math.log(n, k)
if tst * 1.0 == math.floor(tst):
    print(math.floor(tst)+1)

else:
    print(math.ceil(tst))

Submission status: Accepted

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

cnt = 0

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

print(cnt)

Submission status: Accepted

Solution code:
x = input().split()
N = int(x[0])
K = int(x[1])

if N ==1:
    print(1)
else:
    d = 0
    while K ** d <= N:
        d +=1
    print(d)

Submission status: Accepted

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

while not (N >= K ** l and N <= K ** (l+1) - 1):
    l += 1
print(l+1)

Submission status: Accepted

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

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

Submission status: Accepted

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

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())

X =len(base_10_to_n(N,K))
print(X)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from collections import deque, defaultdict
import bisect


def comb(a, b):
    result = 1
    for i in range(b):
        result *= (a - i) / (i + 1)
    return result


def main():
    #N = list(input().strip())
    N, K = map(int, input().split())

    k = 1
    while True:
        if N < K ** k:
            break
        k += 1

    print(k)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
i = 1

def func(i):
    while True:
        if N < K ** i:
            return i
        i += 1

print(func(i))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
import numpy as np

# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

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

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


print()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
import numpy as np

# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())
N, K = map(int, input().split())

M = np.base_repr(N, K)
print (len(str(M)))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
# a = n
ans = str()

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

if n == 0:
    print(len(ans))
else:
    print(len(str(n) + ans))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
def main():
    N,K = map(int,input().split())
    num = 0
    while True:
        if (K**(num-1))<= N < (K**num):
            print(math.ceil(num))
            break
        num+=1
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
n, k = map(int, input().split())
if math.log(n, k) == math.ceil(math.log(n, k)):
  print(int(math.log(n, k)) + 1)
else:
  print(math.ceil(math.log(n, k)))

Submission status: Accepted

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

count = 0
i = 1
while(i <= N):
  count += 1
  i = i * K
print(count)

Submission status: Accepted

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

if N < K:
    print(1)
else:
    count = 0
    while N > K:
        M = N%K
        N = N//K
        if N >= K:
            count += 1
    print(count + 2)

Submission status: Accepted

Solution code:
n, k = list(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())


#test
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)))