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:
def ten2k(n,k):
    if (int(n/k)):
        return ten2k(int(n/k), k) + str(n%k)
    return str(n%k)

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

Submission status: Accepted

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

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:
def main():
    N, K = map(int, input().split(' '))

    i = 0
    while True:
        if N  >= pow(K,i):
            i += 1
        else:
            break

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

Submission status: Accepted

Solution code:
import math 
def findNumberOfDigits(n, base): 
    dig = (math.floor(math.log(n) /
                 math.log(base)) + 1) 
    print (dig)
n,base = [int(i) for i in input().split()]
findNumberOfDigits(n, base)

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=list(map(int,input().split()))
ans=Base_10_to_n(n,k)

print(len(ans))

Submission status: Accepted

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

ret = 0
while N != 0 :
  N //= K
  ret += 1
  
print(ret)

Submission status: Accepted

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

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

print(i)

Submission status: Accepted

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

Submission status: Accepted

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

c = 0
while n != 0:
	n //= k
	c +=1
	
print(c)

Submission status: Accepted

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

res = ''
tmp = n
while tmp >= k:
    res = str(tmp%k) + res
    tmp = int(tmp/k)
res = str(tmp%k) + res
print(len(res))

Submission status: Accepted

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

import sys
from math import floor, log


def main():
    input = sys.stdin.readline
    N, K = map(int, input().split())

    ans = floor(log(N) / log(K) + 1)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

k,r = input().split()
def numberToBase(n, b):
    if n == 0:
        return [0]
    digits = []
    while n:
        digits.append(int(n % b))
        n //= b
    return digits[::-1]


print(len(numberToBase(int(k),int(r))))

Submission status: Accepted

Solution code:
def base10(x,n):
  x_dumy = x
  out = ''
  while x_dumy > 0:
    out = str(x_dumy%n)+out
    x_dumy = int(x_dumy/n)
  return len(out)

A = list(map(int, input().split()))
print(base10(A[0],A[1]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = (int(nk) for nk in input().split())
count = 1
while N > K-1:
    N //= K
    count += 1

print(count)

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:
import math

def finddigit(n, b):
    dig = (math.floor(math.log(n)/math.log(b))+1)
    print(dig)

n,b = map(int,input().split())
finddigit(n,b)

Submission status: Accepted

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

count = 1
X = K

while X <= N:
#     print(X)
    count += 1
    X = X*K
print(count)

Submission status: Accepted

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

x = N
count = 0
while x != 0:
    count = count + 1
    x = int(x/K)

print(count)

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 = list(map(int, input().split(" ")))
    # print(int(str(n), 2))
    #
    # x10 = 35
    x2 = Base_10_to_n(n, k)
    print(len(x2))  # "100011"が表示される．

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if k == 10:
    print(len(str(n)))
else:
    print(len(Base_10_to_n(n,k)))

Submission status: Accepted

Solution code:
def resolve():
    n, k = map(int, input().split())
    arr = []
    while n > 0:
        arr.append(n % k)
        n = n // k
    print(len(arr))

if __name__ == '__main__':
        resolve()

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
x=1
y=1
while x<=n:
  x*=k
  y+=1
if n==1:
  print(1)
else:
  print(y-1)

Submission status: Accepted

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

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

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())
for i in range(1000000000):
    if (k**(i+1))-1>=n:
        print(i+1)
        break

Submission status: Accepted

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

for ans in range(1000000000):
     if n < k**ans:
          print(ans)
          break

Submission status: Accepted

Solution code:
a = input().split()
a=[int(i) for i in a]
n,k=a[0],a[1]
r=0
b=1
while r<1:
    if n>=k**b:
        b=b+1
    else:
        r=1
print(b)

Submission status: Accepted

Solution code:

n,k = map(int, input().split())
keta = 0
saidai = 0
i = 1

while(1):
    saidai = k**i
    if(saidai>n):
        break

    i = i + 1

print(i)

Submission status: Accepted

Solution code:
line = input().rstrip().split(' ')
n = int(line[0])
k = int(line[1])

ans = 0
i = 1
while n >= k:
    ans += (n % k) * i
    n = int(n / k)
    i *= 10
ans += n * i
s = str(int(ans))
print(len(s))

Submission status: Accepted

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

def conv(n, k):
    amari = []
    while n != 0:
        amari.append(n%k)
        n = n // k

    amari.reverse()
    return amari

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

Submission status: Accepted

Solution code:
# ABC 156 B
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nms = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
from math import log
n,k=nm()
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())

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

x = 1
while True:
    m = K ** x
    if N < m:
        print(x)
        exit()
    x += 1

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

Solution code:
def main(n, b):
    if (int(n/b)):
        return main(int(n/b), b) + str(n%b)
    return str(n%b)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import log, ceil


def main():
    N, K = map(int, input().split())
    answer = log(N, K)
    if answer.is_integer():
        print(int(answer) + 1)
    else:
        print(ceil(answer))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
keta=0
p=0
while p==0:
    if n>=k**(keta) and n<k**(keta+1):
        p=1
    else:
        keta=keta+1

print(keta+1)

Submission status: Accepted

Solution code:
n, k = [int(i) for i in input().split()]
def decNbin(t, n):
  a = []
  while t!= 0:
    a.append(t % n)
    t  = t // n
  a.reverse()
  return a
print(len(str("".join(map(str, decNbin(n, k))))))

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 = list(map(int,input().split()))
tmp = K
cnt = 1
while tmp <= N:
    tmp = tmp*K
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
ans = 1

n, K  = map(int, input().split())
while ((n != 1) and (n != 0)):
    n //= K
    ans += 1

if n == 0:
    ans -= 1
print(ans)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
ans = 0
for i in range(1, n+1):
    if n < k**i:
        ans = i
        break

print(ans)

Submission status: Accepted

Solution code:
def base10to(n, b):
    if (int(n/b)):
        return base10to(int(n/b), b) + str(n%b)
    return str(n%b)

n, b = map(int,input().split()) 
ans = base10to(n,b)
print(len(ans))

Submission status: Accepted

Solution code:
import math

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

digit = math.log(n, k)

if digit.is_integer():
    print(int(digit)+1)
else:
    print(math.ceil(digit))

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = -1
for i in range(1, 40):
    if K ** (i - 1) <= N < K ** i:
        ans = i

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

while N//K!=0:
  ans.append(N%K)
  N=N//K
else:
  ans.append(N)
print(len(ans))

Submission status: Accepted

Solution code:
import math

N, K = map(int, input().split())
v = math.floor(math.log(N, K)) + 1
print(v)

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



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

length = base_cvt(str(N), K)
length = len(length)
print(length)

Submission status: Accepted

Solution code:
list = input().split()
N = int(list[0])
K = int(list[1])
x = 0
while True:
  if K**x > N:
    break
  x += 1
    
print(x)

Submission status: Accepted

Solution code:
# coding: utf-8
import math

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

Submission status: Accepted

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

print( A)

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]
a,b = map(int, input().split())
print(len(toStr(a,b)))

Submission status: Accepted

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

keta = 1
sum = 0
while True:
    max = k**keta-1
    if max >= n:
        print(keta)
        break
    keta += 1

Submission status: Accepted

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

def base_10_to_n(x, i):
  if i == 10:
    return str(x)
  if (int(x / i)):
    return base_10_to_n(int(x / i), i) + str(x % i)
  return str(x % i)

print(len(base_10_to_n(n, k)))

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())
ans = 0
ch = 0
while ch == 0:
  n = N // K
  if n==0:
    ch = 1
  N /= K
  ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
for i in range(50):
  if n>=k**i and n<k**(i+1):
    ans=i+1
    break
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

Submission status: Accepted

Solution code:
from sys import stdin


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 get_result(data):
    N, K = data[0]
    return len(Base_10_to_n(N, K))

if __name__ == '__main__':
    raw_data = [val.rstrip('\n') for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)

Submission status: Accepted

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

cnt = 0
while True:
    cnt += 1
    N = N // K
    if N == 0:
        break
print(cnt)

Submission status: Accepted

Solution code:

import math 
n , base = map(int, input().split(" "))
print (math.floor(math.log(n)/math.log(base)) + 1)

Submission status: Accepted

Solution code:
def new_value(value, shinsu):
    count = 0
    while(value > 0):
        count += 1
        value //= shinsu
        
    return count

if __name__ == '__main__':
  value, shinsu = input().split()
  value = int(value)
  shinsu = int(shinsu)
  
  print(new_value(value, shinsu))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = list(map(int, input().split()))
c = 1
for _ in range(10**15):
    N = (N - N % K) // K
    if N == 0:
        break
    c += 1
print(c)

Submission status: Accepted

Solution code:
# ABC156 B

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

for i in range(1, 10000000000000):
    if k**i > n:
        print(i)
        break

Submission status: Accepted

Solution code:
def solve(X, n):
    if X // n != 0:
        return solve(X // n, n) + str(X % n)
    return str(X % n)

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

print(len(solve(N, K)))

Submission status: Accepted

Solution code:
import  math
N, K = map(int, input().split())
t = 1
x = N
n = 0
while (True):
    n += 1
    x -= t * (K - 1)
    if x <= 0:
        break

    t *= K


print(n)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    n, k = LI()
    ans = 0
    while n:
        n //= k
        ans += 1
    print(ans)
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n,k =map(int,input().split())
c=0
for i in range(10**9):
  if k**(i+1)>n:
    c=i+1
    break
  elif k**(i+1)==n:
    c=i+1+1
    break
   
print(c)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N, K = map(int, input().split())

if N < K:
    print(1)
else:
    ans = 0
    for i in range(1, N // 2):
        if N < (K ** i):
            ans = i
            break

    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)

number_list = [int(i) for i in input().split()]
n_val = base_10_to_n(number_list[0], number_list[1])
len_val = len(n_val)
print(len_val)

Submission status: Accepted

Solution code:



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

if __name__ == "__main__":
    N, K = map(int, input().split())
    print(len(Base_10_to_n(N, K)))

Submission status: Accepted

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

if n == 1:
    print(1)
    exit()

ans = - (-math.log(n)//math.log(k))

print(int(ans))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline


def main():
    n, k = map(int, input().split())
    r = n
    u = []
    while(r >= k):
        s = r // k
        t = r % k
        u.append(t)
        r = s
    u.append(r)
    print(len(u))


if __name__ == '__main__':
    main()

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:
# B - Digits

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 = map(int,input().split())
ans = math.floor(math.log(N)/math.log(K)+1)
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())
if K!=10:
  N = Base_10_to_n(N, K)
print( len(str(N)) )

Submission status: Accepted

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

a = []

while N >= K:
    y = N % K
    a.append(str(y))
    N = N // K

x = N % K

a.append(str(x))

ans = len(a)

print(ans)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
val = 1
if N == 1:
    print(1)
else:
    for i in range(1,N):
        val = val * K
        if val > N:
            print(i)
            break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools


n, r = map(int, input().split())
# p = list(map(int, input().split()))
# s = input().split()
# S = [int(input()) for i in range(int(n))]
i =0


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)


x2 = Base_10_to_n(n, r)
print(len(x2))  # "100011"が表示される．

# print(r+i)

Submission status: Accepted

Solution code:
input_line = 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)


result = Base_10_to_n(input_line[0], input_line[1])
print(len(result))

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
def tanaka(n,k):
  if (int(n/k)):
    return tanaka(int(n/k),k)+str(n%k)
  return str(n%k)

print(len(tanaka(n, k)))

Submission status: Accepted

Solution code:
i= list(map(int, input().split()))
j=1
while i[0]>=i[1]**j:
  j+=1
print(j)

Submission status: Accepted

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


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


print(len(to_str(N, K)))

Submission status: Accepted

Solution code:
N,K = list(map(int, input().split()))
s = []
while N > 0:
    amari = N % K
    N = N - amari
    N = N / K
    s.append(amari)
print(len(s))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

while n // k != 0:
    digit += str(n % k)
    n = n // k

print(len(digit)+1)

Submission status: Accepted

Solution code:
from math import log

number, base = map(int, input().split())
digit = int(log(number, base)) + 1
print(digit)

Submission status: Accepted

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

#res_reversed_list = []
res = 0

while N != 0:
#    res_reversed_list.append(N % K)
    res += 1
    N //= K

#print((map(str, res_reversed_list)))
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main(n,k):
    res = 0
    val = 1
    while val <= n :
        res += 1
        val = val * k
    return res
 
n,k = map(int, input().split())
print(main(n,k))

Submission status: Accepted

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



count=0
now=1
while N>=now:
  now*=K
  count+=1
  
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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)

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

Submission status: Accepted

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

def b10_to_n(x, n):
    s = str()
    while True:
        xx = x // n
        s += str(x % n) 
        x = xx
        if x == 0:
            break
    return s

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

result = ""
temp = n
while temp >= 1:
    result = str(temp % k) + result
    temp = temp // k

print(len(result))

Submission status: Accepted

Solution code:
import sys

n, k = map(int, input().split())
i = 0
while True:
  if k**i > n:
    print(i)
    sys.exit()
  else:
    i += 1

Submission status: Accepted

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


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


def main():
    N, K = map(int, input().split())
    print(len(dig(N, K)))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

def base10ton(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(base10ton(N,K)))

Submission status: Accepted

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

  digit = 0

  while(True):
    N = N / K
    digit += 1
    if N < 1:
      break
  
  print(digit)

if __name__ == '__main__':
  main()

Submission status: Accepted

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

n = 0
count = 1

while True:
	n = N // K
	if n == 0:
		break
	else:
		N = N // K
		count += 1

print(count)

Submission status: Accepted

Solution code:
n, r = map(int, input().split())
count = 0
if n == 1:
    print(1)
else:
    while n // r >= r:
        count += 1
        n = n // r
    print(count + 2)

Submission status: Accepted

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

ans = ""

while True:
  r = str(N % K)
  ans += r
  N = N // K
  if N < K:
    ans += str(N % K)
    break

ans = ans[::-1]
if ans[0] == "0":
  ans = ans[1:]  

print(len(ans))

Submission status: Accepted

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

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

print(num)

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())
for i in range(10**9):
    if K**i<=N<K**(i+1):
        print(i+1)
        break

Submission status: Accepted

Solution code:
import math

N,K = map(int,input().split())
ans = math.floor(math.log(N, K)) + 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def clac(n, k):
    x = []
    while(n > 0):
        x.append(str(n%k))
        n = n//k
    return ("").join(x[::-1])

print(len(clac(N, K)))

Submission status: Accepted

Solution code:
#!/use/bin/env python3

from collections import defaultdict

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

ans = 0

while n != 0:
    n //= k
    if n != 0:
        ans += 1

print(ans + 1)

Submission status: Accepted

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

Submission status: Accepted

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


while N // K != 0:
    n = N // K
    N = n
    count += 1

print(str(count + 1))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n,r=list(map(int,input().split()))
#n=10**9
#r=2
for i in range(40,-1,-1):
    if r**i<=n:
        ans=i+1
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n, k = map(int, input().split())
    count = []
    while n != 0:
        count.append(n % k)
        n = n // k
    print(len(count))


if __name__ == "__main__":
    main()

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
n,k=(int(x) for x in input().split())

ans = 1
sum = k

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

Submission status: Accepted

Solution code:
N,K = 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())
cnt = 0
while(True):
  if n<k:
    print(cnt+1)
    exit()
  n=n//k
  cnt+=1

Submission status: Accepted

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

i = 1
while (K ** i) - 1 < N:
  i += 1

print(i)

Submission status: Accepted

Solution code:
#abc 156 b
def keta(x):
    cnt=0
    while x>0:
        x=int(x/k)
        cnt+=1
    return cnt
n,k=map(int,input().split())
ans=keta(n)
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:
a,b = map(int,input().split())
def baseN(num, b, numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
    return((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b])
print(len(baseN(a, b)))

Submission status: Accepted

Solution code:
a = input().split()
for i in range(len(a)):
    a[i] = int(a[i])

ind = 0
while a[0] > 0:
    a[0] = a[0] // a[i]
    ind +=1

print(ind)

Submission status: Accepted

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

print(c)

Submission status: Accepted

Solution code:
import math

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

# 変換公式より
ans = int(math.log(n)/math.log(k))+1
print(ans)

Submission status: Accepted

Solution code:
def main():
	n,k=map(int, input().split())
	m =1
	while True:
		if k**(m-1)<=n and n<k**m:
			print(m)
			break
		else:
			m=m+1
			continue
main()

Submission status: Accepted

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

stopFlg = True
result = ''
nowValue = n
while nowValue >= k:
    result = str(nowValue%k) + result
    nowValue = nowValue // k
result = str(nowValue%k) +result
print(len(result))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

a,b=map(int,input().split())

if math.log(a,b).is_integer():
    print(math.ceil(math.log(a,b))+1)
else:
    print(math.ceil(math.log(a,b)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
n,k= map(int,input().split())
dig = int(np.ceil(np.log(n)/np.log(k)))
if k**(dig) == n:
    dig = dig + 1
print(dig)