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:
N,K = list(map(int,input().split()))
A = []
A.append(1)

for i in range(N):
    p = K * A[i]
    if p > N:
        print(i+1)
        break
    else:
        A.append(p)

Submission status: Accepted

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

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

if K<=N:
    while (N/K)>=1:
        K = K*K_origin
        result += 1

print(result)

Submission status: Accepted

Solution code:
import math

N, K = [int(i) for i in input().split()]
print(int(math.floor(math.log(float(N)/math.pow(K,2), K))) + 1 + 2)

Submission status: Accepted

Solution code:
line = input()
x, k = line.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(int(x), int(k))
str_num = str(ans)
print(len(str_num))

Submission status: Accepted

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

n=N
count=0

while n>0:
    n=int(n/K)
    count+=1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range (100000):
    if N < K**i:
        print(i)
        break

Submission status: Accepted

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

while n != 0:
	ans += str(n%k)
	n = int(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))

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

Submission status: Accepted

Solution code:
X,Y = map(int,input().split())

n=1
for i in range(1000):
   n=n*Y
   if(n>X):
       print(i+1)
       exit()

Submission status: Accepted

Solution code:
import numpy as np
import math

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

temp = np.log(n)/np.log(k)

if n==1:
    print(1)
else:
    print(math.ceil(temp))

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
if k == 10:
    print(len(str(n)))
else:
    count=0
    while True:
        count+=1
        if n < k**count:
            break
    print(count)

Submission status: Accepted

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

while N>=a:
    ans+=1
    a=a*K
print(ans)

Submission status: Accepted

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

n,k = map(int,input().split())
ans = nsin(n,k)
str_ans = str(ans)
print(len(str_ans))

Submission status: Accepted

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

print(floor(log(N, K))+1)

Submission status: Accepted

Solution code:
a, b = input().split()
c = int(a)
d = int(b)
 
flag = True
ans = 1
 
while flag:
  if d ** ans > c:
    flag = False
    break
  else:
    ans += 1
    
print(str(ans))

Submission status: Accepted

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

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

def solve(N: int, K: int):
    return len(base10to(N, K))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
    print(solve(N, K))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

if N == 1:
    print(1)
else :
    print(math.ceil(math.log(N, K)))

Submission status: Accepted

Solution code:
from sys import stdin
s = stdin.readline().rstrip().split()
n, k = int(s[0]), int(s[1])
ans = 0
while(n >= pow(k, ans)):
    ans += 1
    # print(ans)
    # print(pow(k, ans))

print(ans)

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
s = True
r = 0
while s:
	if n // (k**r) == 0:
		s = False
	else:
		r = r+1
print(r)

Submission status: Accepted

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

Submission status: Accepted

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

def numberToBase(n, b):
    if n == 0:
        return [0]
    digits = []
    while n:
        digits.append(int(n % b))
        n //= b
    return len(digits[::-1])
  
print(numberToBase(N, K))

Submission status: Accepted

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

count = 0

while k**count <= n:
    count += 1

print(count)

Submission status: Accepted

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

count = 0

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

print(count)

Submission status: Accepted

Solution code:
import math
n,k=(int(x) for x in input().split())
print(int(math.log(n,k))+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import math

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

log_K = np.log(N)/np.log(K)


ans = int(math.ceil(log_K))

if ans == 0:
    print "1"
else:
    print ans

Submission status: Accepted

Solution code:
#ABC156 B - Digits

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

for i in range(10**9):
    if(n < k**i):
        print(i)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import string
digs = string.digits + string.ascii_letters

def int2base(x, base):
    if x < 0:
        sign = -1
    elif x == 0:
        return digs[0]
    else:
        sign = 1
    x *= sign
    digits = []
    while x:
        digits.append(digs[int(x % base)])
        x = int(x / base)
    if sign < 0:
        digits.append('-')
    digits.reverse()
    return ''.join(digits)
a,b = map(int,input().split())

print(len(int2base(a, b)))

Submission status: Accepted

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

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

print(len(func(n,k)))

Submission status: Accepted

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

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

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

print(count)

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

print(Base_10_to_n(N, R))

Submission status: Accepted

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

i = 1
while n >= k**i:
    i += 1

print(i)

Submission status: Accepted

Solution code:
inp = input().split(" ")
n, k = int(inp[0]), int(inp[1])
# print(n, k)

squared = 1
count = 0
while squared <= n:
  squared *= k
  # print(squared)
  count += 1
print(count)

Submission status: Accepted

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

while N != 0:
  A.insert(0, N % K)
  N = int(N / K)
  
print(len(A))

Submission status: Accepted

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

Submission status: Accepted

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

for count in reversed(range(0,100)):
    if N % (K**count) < N:
        print(count + 1)
        break

Submission status: Accepted

Solution code:
a,b=input().split()
a=int(a)
b=int(b)
c=b
i=1
while a>=c:
    c=c*b
    i+=1
print(i)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

ans=0

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

  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

inputs = [int(i) for i in input().split(" ")]

print(math.floor(math.log(inputs[0], inputs[1]))+1)

Submission status: Accepted

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

Submission status: Accepted

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

l = math.log(n, r)
    
print(int(l+1))

Submission status: Accepted

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

Submission status: Accepted

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

i = 0
l = k ** i

if n <= k:
    print(1)
    exit(0)

while l <= n:
    l = k ** i
    # print(l)
    i += 1
print(i - 1)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
for i in range(1000):
  if k**i>n:
    ans = i
    break
    

print(ans)

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

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

Submission status: Accepted

Solution code:
#B
#入力
N,K=map(int,input().split())

#処理
import math 
print(math.floor(math.log(N,K)+1))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
count = 0
for _ in range(n):
  if n == 0:
    break
  n = n // k
  count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(10**8):
  if a[1]**i > a[0]:
    break
print(i)

Submission status: Accepted

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

while n > 0:
    n, _ = divmod(n, k)
    cnt += 1
print(cnt)

Submission status: Accepted

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

def solve(N: int, K: int):
    i = 0
    while True:
        if N >= (K ** i):
            i += 1
        else:
            print(i)
            break

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())
num, answer = N, ""
while num:
    mod = N % K
    num = num // K
    answer = chr(48 + mod + 7*(mod > 10)) + answer
print(N) if K == 1 else print(len(answer))

Submission status: Accepted

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

print(a)

Submission status: Accepted

Solution code:
import sys
n,k=map(int,input().split())
for i in range(n):
  if k**i<=n and n<k**(i+1):
    print(i+1)
    sys.exit()

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())
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())
m = 1
ans = 0

while n >= m:
  m *= k
  ans += 1

print(ans)

Submission status: Accepted

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

if ceil(log(n,k)) != log(n,k):
    print(ceil(log(n,k)))
else:
    print(ceil(log(n,k))+1)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

N, K = map(int, input().strip().split())
ans = math.ceil(math.log(N,K))
if ans == 0:
    ans = 1
print(ans)

Submission status: Accepted

Solution code:
a=input().split()
nm=[]
for i in range(2):
  b=int(a[i])
  nm.append(b)
n=nm[0]
m=nm[1]
t=0
while True:
  if m**t<=n and n<m**(t+1):
    t+=1
    break
  else:
    t+=1
print(t)

Submission status: Accepted

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

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

Submission status: Accepted

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

print(len(out))

Submission status: Accepted

Solution code:
import numpy as np

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

result = 0
for i in range(1, 10**9):
    if (N >= K**(i-1)) & (N<K**i):
        result = i
        break
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def strr():
 a=raw_input()
 return a
def sstrr():
 a=raw_input().split()
 return a
def intt():
 a=int(raw_input())
 return a
def iintt():
 a=[int(s) for s in raw_input().split()]
 return a
def nestt(t):
 a=[raw_input().split() for s in range(t)] 
 return a

nk=iintt()
n=nk[0]
k=nk[1]
a=0
s=1
while n>=s:
 s*=k
 a+=1
if a==0:
 a=1
print a

Submission status: Accepted

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

Submission status: Accepted

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

i = 0
c = 0
t = 1
while True:
    if N // t == 0:
        break
    c += 1
    i += 1
    t *= K

print(c)

Submission status: Accepted

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

Submission status: Accepted

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

i = 0
while True:
    if n >= k**i and n < k**(i+1):
        print(i+1)
        break
    i += 1

Submission status: Accepted

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

amari_list = []


def hoge(N, K):
    if N == 0:
        return amari_list
    sho = N//K
    amari = N%K

    amari_list.append(amari)
    return hoge(sho, K)

print(len(hoge(n, k)))

Submission status: Accepted

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

a = 1
for n in range(32):
    if N < a:
        print(n)
        break
    a *= K

Submission status: Accepted

Solution code:
import math


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())
res = int(Base_10_to_n(N, K))
ans = int(math.log10(res) + 1)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

dummy = N
out = ''
while dummy > 0:
    out = str(dummy % K) + out
    dummy = dummy // K

print(len(out))

Submission status: Accepted

Solution code:
n, k = [int(each) for each in input().split(' ')]
for i in range(50):
    if n >= k**i and k**(i+1) > n:
        print(i+1)

Submission status: Accepted

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


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__':
    main()

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())
ans=1
while n>0:
  if n/k>=1:
    ans+=1
    
  else:
    print(ans)
    exit()
  n/=k



print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(t)

Submission status: Accepted

Solution code:
N,K=(int(x) for x 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)

A=Base_10_to_n(N,K)

print(len(A))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:

import math
count = 0
N,K=map(int,input().split())
while N>=1:
    N=N//K
    count += 1
print(count)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
def numberToBase(n, b):
    if n == 0:
        return [0]
    digits = []
    while n:
        digits.append(int(n % b))
        n //= b
    return len(digits[::-1])
print(numberToBase(N, K))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
import queue
import copy


#X = str(input()).split()
#a = [int(x) for x in input().split()]


NK = str(input()).split()
N = int(NK[0])
K = int(NK[1])
ans = 1

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

if(N<=K):
  ans = 1


print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
ans = []
if N == 0:
  ans = ["0"]
while N != 0:
  ans.append(str(N % K))
  N //= K
ans = ("".join(list(reversed(ans))))
print(len(ans))

Submission status: Accepted

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

res = []

while True:
    if N < K:
        break

    m = N % K
    div = N // K

    res.append(m)

    N = div

print(len(res) + 1)

Submission status: Accepted

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

    print(cnt)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
N,K=map(int,input().split())                            # 1行2列

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

print(count)

Submission status: Accepted

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

def division(x):
  if x<1:
    return 0
  x = x/k
  ans = 1
  return ans + division(x)

print(division(n))

Submission status: Accepted

Solution code:
a = list(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 = a[0]
x2 = Base_10_to_n(x10, a[1])

print(len(str(x2)))

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

c = Base_10_to_n(n, k)

print(len(str(c)))

Submission status: Accepted

Solution code:
import math
import itertools
import statistics
#n = int(input())
#n, d = list(input().split())
n, k = list(map(int, input().split()))

p = 1
keta = 1
while p <= n:
    p *= k
    keta+=1

print(keta-1)

Submission status: Accepted

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

ans = ''
while n > 0:
    ans = str(n % k) + ans
    n //= k
print(len(ans))

Submission status: Accepted

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

result = []
while True:
    if n < k:
        result.append(n)
        break
    else:
        t = n % k        
        result.append(t)
        n = n // k

print(len(result))

Submission status: Accepted

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

print(c+1)

Submission status: Accepted

Solution code:
import math

n,k=map(int,input().split())
print(math.ceil(math.log(n,k))  if n>=k else 1)

Submission status: Accepted

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

while N >= K:
    N = N // K
    counter = counter+1
else:
    counter = counter + 1
    print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

ans=0

while True:
	
	if N<(K**ans): break
	
	ans+=1


print(ans)

Submission status: Accepted

Solution code:

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

ans = ''

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

ans = (len(x2))

print(ans)

Submission status: Accepted

Solution code:
N, K = map(int, 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(str(base_cvt(N, n=K))))

Submission status: Accepted

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

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

print(len(dec_to_n(N, K)))

Submission status: Accepted

Solution code:
line = input().split(" ")

N, K = int(line[0]), int(line[1])

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# スペース区切りの整数入力
N,K = map(int, input().split())

for i in range(10000000000000):
    if N <= K ** i - 1:
        break
print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
N,K = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0
for k in range(10000000):
    if N < K**k:
        break
    
print(k)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
ans = []
while True:
    if N // K == 0:
        ans.append(N)
        break
    ans.append(N%K)
    N //= K
print(len(ans))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def solve():
    N, K = map(int, input().split())
    i = 1
    while K**i-1 < N:
        i += 1
    return str(i)

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

Submission status: Accepted

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

# print(ans)
print(len(ans)+1)

Submission status: Accepted

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

ans = 0
count = 0

while(True):
  if K**count <= N < K**(count+1):
    ans = count
    break

  count += 1

print(ans+1)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np

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


for i in range(N):
    if (K**i <= N) & (K**(i+1) > N):
        ans = i+1
        break
        
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 = list(map(int, input().split()))
ans = ""

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

print(len(ans))

Submission status: Accepted

Solution code:
import numpy as np

NK=np.array(input().split(),dtype=np.int32)

N=NK[0]
K=NK[1]

count=1
th=K
while(True):
    if(N>=th):
        count+=1
        th=th*K
    else:
        break

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

res += 1
print(int(res))

Submission status: Accepted

Solution code:
import socket
import sys

hostnames = ['N551J', 'F551C', 'X553M']
input_file = 'b1.in'
if socket.gethostname() in hostnames:
    sys.stdin = open(input_file)


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


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


def solve():
    n, k = read_int_list()
    res = 0
    while n > 0:
        n //= k
        res += 1
    return res


def main():
    res = solve()
    print(res)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

a, b = input().split()
a = int(a)
b = int(b)
c = toStr(a, b)
c = int(c)
count = 0
while(c>0):
    count=count+1
    c=c//10
print(count)

Submission status: Accepted

Solution code:
N,R=map(int,input().split())
count=1
for i in range(1,51):
    if N>=R**i:
        count+=1
print(count)

Submission status: Accepted

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

value = N
ans = []

while (value != 0):
    ans.append(value % K) 
    value = int(value // K)

print(len(ans))

Submission status: Accepted

Solution code:
# 2020/02/22
# AtCoder Beginner Contest 156 - B

def chg_ks(x, n):
    if (x // n != 0):
        return chg_ks(x // n, n) + str(x % n)
    else:
        return str(x % n)
    
# Input
n, k = map(int,input().split())

# Calc
ans = len(chg_ks(n, k))

# Output
print(ans)

Submission status: Accepted

Solution code:
def resolve_b():
    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)))
resolve_b()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
#sys.setrecursionlimit(150000)


def solve(N: int, K: int):
    ketamax=K-1
    keta=1
    while(N>ketamax):
        keta+=1
        ketamax=(ketamax+1)*K-1
    print(keta)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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())

import math

q = math.log(n,k)
print(math.floor(q+1))

Submission status: Accepted

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

num_of_digits = 1

while N >= K ** num_of_digits:
    num_of_digits += 1

print(num_of_digits)

Submission status: Accepted

Solution code:
from numpy import log
N,K = list(map(int,input().split()))

print(int(log(N)/log(K)+1))

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
Hi = 30
Lo = 0

while Hi-Lo > 1:
    Mid = (Hi+Lo)//2
    if N < K**Mid:
        Hi = Mid
    else:
        Lo = Mid

print(Hi)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	N,K = MI()
	n = N
	ans = 1
	while N >= K:
		N //= K
		ans += 1
	print(ans)


if __name__ == '__main__':
	main()

Submission status: Accepted

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

cnt = 0
while 0 < N:
    N = N // K
    cnt += 1

print(cnt)