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:
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.4.3)

import math
import statistics
import numpy as np
import queue
import itertools

n,k = map(int, input().split())
p = 1
for i in range(0, 114514):
	if p <= n:
		p *= k
	else:
		print(i)
		break

Submission status: Accepted

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


def calc(n, k, cnt):
    if n >= k:
        n = n // k

        return calc(n, k, cnt + 1)
    else:
        print(cnt)


calc(n, k, 1)

Submission status: Accepted

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

Submission status: Accepted

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

ans = ""
while n >= k:
    ans = str(n % k) + ans
    n = int(n / k)
    
ans = str(n) + ans
print(len(ans))

Submission status: Accepted

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

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

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

n,k = LI()
ans = 0
while n:
    n//=k
    ans+=1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N, K = LI()
ans = 0
tmp = 1
while tmp - 1 < N:
    tmp *= K
    ans += 1

print(ans)

Submission status: Accepted

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

#output
answer = 0
while N >=1:
    N = N//K
    answer += 1

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

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

main()

Submission status: Accepted

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

i = []
while N > 0:
  i.append(N%K)
  N = N // K
  
print(len(i))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
str = input().split()
N = int(str[0])
K = int(str[1])
result = N
counta = 0
while True:
	result = result/K
	if(result<1):
		counta+=1
		break
	else:
		counta+=1
print(counta)

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:
import sys
input = sys.stdin.readline

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

d = 0
while N:
    N //= K
    d += 1

print(d)

Submission status: Accepted

Solution code:
# B - Digits
def main():
    N, K = map(int, input().split())
    digits = 0
    while N:
        N //= K
        digits += 1
    print(digits)


if __name__ == "__main__":
    main()

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:
#Digit
n, k = map(int, input().split())
d = 0
while n:
    n = n//k
    d += 1
    if n == 0:
        break
print(d)

Submission status: Accepted

Solution code:
def base_10_to_n(x, n):
    if (int(x/n)):
        return base_10_to_n(int(x/n), n)+str(x%n)
    return str(x%n)

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

Submission status: Accepted

Solution code:
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from sys import stdin
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(n,k):
	return 1 + floor(log(n,k))
	

N,K = map(int, stdin.readline().rstrip().split())
ans = solve(N,K)
print(ans)

Submission status: Accepted

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

ret = 0
while n:
    n //= k
    ret += 1

print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math


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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
digit_str = ''
keta = N
while True:
    keta, amari = keta//K, str(keta%K)
    if keta==0:
        digit_str = digit_str + amari
        break
    digit_str = digit_str + amari

print(len(digit_str))

Submission status: Accepted

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

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:
import numpy as np
n, k = map(int, input().split())


def log(r, d):
    return np.log(d)/np.log(r)


def ceil(x):
    if x.is_integer():
        return int(x) + 1
    return int(np.ceil(x))


print(ceil(log(k, n)))

Submission status: Accepted

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


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


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


def S(): return input()


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


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


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


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


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


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


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


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

show_flg = False
# show_flg = True


def conv(x, n):
    if x < 0:
        return None
    if n < 2 or 16 < n:
        return None

    if x == 0:
        return 0

    nchar = '0123456789ABCDEF'
    result = ''

    while x > 0:
        result = nchar[x % n] + result
        x = x // n

    return result


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import log, ceil

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

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

Submission status: Accepted

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


def solve(N: int, K: int):
    ans = 0
    while N:
        N, mod = divmod(N, K)
        #print(N, mod)
        ans += 1

    print(ans)
    #print(int(str(N), K))
    #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:
import math as m
n,k = map(int,input().split())
print(m.ceil(m.log(n,k)) if n-1 else 1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def solve():
    N, K = map(int, input().split())
    
    ans = 0
    while N > 0:
        N = N // K
        ans += 1
    
    print(ans)
    
if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
def keta(n, k):
    cnt = 0
    while(n != 0):
        n //= k
        cnt += 1
    return cnt


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

Submission status: Accepted

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


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

print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def keta(n,k):
    cnt=0
    while(n!=0):
        n//=k
        cnt+=1
    return cnt

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

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
import numpy as np
ans=len(np.base_repr(n,k))
print(ans)

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 sys
input = sys.stdin.buffer.readline

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

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

print(ans)

Submission status: Accepted

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

ans=1
x=n
while x//r>=1:
    x=x//r
    ans+=1
    #print(x)
print(ans)

Submission status: Accepted

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

count = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
n, r = map(int, input().split())
print(len(str(np.base_repr(n,r))))

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 
import math
 
def resolve():
    N, K = map(int, input().split())
    print(math.floor(math.log(N, K))+1)
 
if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

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()))
print(len(Base_10_to_n(N,K)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

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)

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

Submission status: Accepted

Solution code:
import fractions
import collections
from collections import deque
import math
import itertools

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

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k=map(int,input().split());print(sum(n>=k**i for i in range(100)))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
li = []
while True:
    li.insert(0, N % K)
    N = int(N/K)
    if N == 0:
        break

print(len(li))

Submission status: Accepted

Solution code:
N , K  =map(int, input().split())
def nbin(target):
  amari = []

  while target !=0:
    amari.append(target % K)
    target = target // K
  return amari
print(len(nbin(N)))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
 
binary = "" 
i = 0
if k == 10:
  print(len(str(n)))
else:
  while n:
    n, r = divmod(n, k)
    binary = binary + str(r)
  print(len(binary))

Submission status: Accepted

Solution code:
n,k=map(int,input().split());print(sum(n>=k**i for i in range(1,100))+1)

Submission status: Accepted

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

Submission status: Accepted

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

d = 1
C = K
while N >= C:
    d += 1
    C *= K
print(d)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def dec_to_base(num,base):  #Maximum base - 36
    base_num = ""
    while num>0:
        dig = int(num%base)
        if dig<10:
            base_num += str(dig)
        else:
            base_num += chr(ord('A')+dig-10)  #Using uppercase letters
        num //= base

    base_num = base_num[::-1]  #To reverse the string
    return base_num

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

Submission status: Accepted

Solution code:
[N,K] = list(map(int,input().split()))
if N<K:
    print(1)
else:
    i=N
    j=0
    while i>=K:
        i = i/K
        j=j+1
    print(j+1)

Submission status: Accepted

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

N = inpt[0]
K = inpt[1]

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()); a=0
while n: n//=k; a+=1
print(a)

Submission status: Accepted

Solution code:
# coding: utf-8

number = input().split(" ")
N = int(number[0])
K = int(number[1])
ans = 0
while N > 0:
    n = N % K
    N = N // K
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
def reduce_num(x, y):
  if x>=y:
    string_num.insert(0, x%y)
    reduce_num(x//y, y)
  else:
    string_num.insert(0, x)

N, K = map(int, input().split())
string_num = []
reduce_num(N, K)
print(len(string_num))

Submission status: Accepted

Solution code:
import math
N,K = map(int,input().split())
start = K**int(math.log(N,K))
X = []
while start !=0:
    if N - start >= 0:
        N = N-start
        X.append(1)
    else:
        X.append(0)
    start = int(start / K)
print(len(X))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def x_base(n, x):
  j = []
  while(1):
    if(n < x):
      j.append(n)
      break
    else:
      j.append(n % x)
      n //= x
  return j


n = [int(i) for i in input().split()]
print(len(x_base(n[0], n[1])))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input = input()

arr = input.split(" ")
N = int(arr[0])
K = int(arr[1])

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

R = Base_10_to_n(N, K)

print(len(str(R)))

Submission status: Accepted

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

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

print(len(f_10_to_n(N, K)))

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

Submission status: Accepted

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

i = 1
s = 1
d = 0

while s > 0:
  s = N // i
#  print('s=', s)
  i = i * K
#  print('i=', i)
  d += 1
#  print('d=', d)

if s == 0:
  d -= 1

print(d)

Submission status: Accepted

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

e = 0
for i in range (1000):
    if (n / (k ** (i+1))) >= 1:
        e = e + 1
    else:
        e = e

f = e + 1

print (f)

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:
s=input("")
l=s.split()
N=int(l[0])
K=int(l[1])
for i in range(10000):
    if N>=K**i and N<K**(i+1):
        print(i+1)

Submission status: Accepted

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

binary = "" 
i = 0
if k == 10:
  print(len(str(n)))
else:
  while n:
    n, r = divmod(n, k)
    binary = binary + str(r)
  print(len(binary))

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 
import math

def base_cvt(value, n=2):
    characters = '0123456789'
    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 resolve():
    N, K = map(int, input().split())
    print(len(str(base_cvt(N, n=K))))

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

num = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import collections as col
input=sys.stdin.readline

def mainA():
	N,R=map(int,input().split())
	#N=input().rstrip()
	#N=int(input())
	#vA=list(map(int,input().split()))
	
	if N >= 10:
		res = R
	else:
		res = R + 100*(10-N)
	
	print(res)

def mainB():
	N,K=map(int,input().split())
	#N=input().rstrip()
	#N=int(input())
	#vA=list(map(int,input().split()))
	
	res = 0
	while N:
		N //= K
		res += 1
	
	print(res)

def mainC():
	#N,K=map(int,input().split())
	N=input().rstrip()
	#N=int(input())
	vA=list(map(int,input().split()))
	
	res = float("inf")
	for i in range(1, 101):
		t = sum((x-i)**2 for x in vA)
		res = min(res, t)
	
	print(res)


#mainA()
mainB()
#mainC()

Submission status: Accepted

Solution code:
import math
dec, base = list(map(int, input().split(' ')))
if dec == 1:
  print(1)
else:
  print(math.ceil(math.log(dec,base)))

Submission status: Accepted

Solution code:
def base_changer(number,base):
    buff=97+abs(base-10)
    dic={};buff2='';buff3=10
    for i in range(97,buff+1):
        dic[buff3]=chr(i)
        buff3+=1   
    while(number>=base):
        mod=int(number%base)
        number=int(number//base)
        if (mod) in dic.keys():
            buff2+=dic[mod]
            continue
        buff2+=str(mod)
    if (number) in dic.keys():
        buff2+=dic[number]
    else:
        buff2+=str(number)

    return buff2[::-1]  
N,K = map(int, input().split())
print(len(base_changer(N,K)))

Submission status: Accepted

Solution code:
import math

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

answer = math.floor(math.log(n) / math.log(k)) + 1
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
N,K = map(int,input().split())
K0 = K
if N < K:
    print(1)
    sys.exit()
count = 1
while N>=K:
    K=K*K0
    count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = map(int,input().split())
l = []
while True:
  if n < k:
    l.append(n)
    break
  l.append(n%k)
  n = n/k
print(len(l))

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)
a=Base_10_to_n(N,K)
print(len(a))

Submission status: Accepted

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

result = ''
if N == 0:
    result += str(N)

while( N != 0 ):
    q, mod = divmod(N, K)
    # print(q,mod)
    result += str(mod)
    N = q

# print(''.join(list(reversed(result))))
print(len(list(reversed(result))))

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

######今回は二進数に変換######
x2 = Base_10_to_n(N, K)
print(len(x2))

Submission status: Accepted

Solution code:

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

ans = ''
while N>0:
        ans = str(N%R)+ans
        N = int(N/R)

print(len(ans))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
import string
numbers = "0123456789"
alphabets = string.ascii_letters
chara = numbers + alphabets


def base_cvt(value, n=2):
    try:
        tmp = int(value)
    except:
        raise ValueError('Invalid value:', value)
 
    if n < 2 or n > len(chara):
        raise ValueError('Invalid n:', value)
 
    result = ''
    tmp = int(value)
    while tmp >= n:
        idx = tmp%n
        result = chara[idx] + result
        tmp = int(tmp / n)
    idx = tmp%n
    result = chara[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=input().split()
N=int(N)
K=int(K)

NN=[]
A=0
while N>=K:
    NN.append(N)
    N=int(N/K)
    A+=1
X=A+1
print(X)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
ans = 0
while n: # 一番下の桁を削る
  ans += 1
  n //= k
print(ans)

Submission status: Accepted

Solution code:
import numpy as np

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

ans = int(np.log10(n) / np.log10(k)) + 1

print(ans)

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def main():
    t = input().split()
    n,k = int(t[0]),int(t[1])
    
    logk = int(math.log(n,k))+1

    print(logk)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import string
n,k=map(int,input().split())
numbers="0123456789"
alphabets=string.ascii_letters
characters=numbers+alphabets

def base_cvt(value, n=2):
    tmp=int(value)
    result = ''
    while tmp >= n:
        idx = tmp%n
        result = characters[idx] + result
        tmp = int(tmp / n)
    idx = tmp%n
    result = characters[idx] + result
    return result
print(len(base_cvt(str(n),k)))

Submission status: Accepted

Solution code:
import math

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

while n > k-1:
    n = math.floor(n/k)
    count += 1

print(count)

Submission status: Accepted

Solution code:
import math
n = input().split()
print((math.floor(math.log(int(n[0])) /
                 math.log(int(n[1]))) + 1))

Submission status: Accepted

Solution code:
n,k = map(int ,input().split())
am=[]
while True:
    if n==0:
        print(len(am))
        exit()
    else:
        n=n//k
        am.append(n%k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
data = input()
num = int(data.split()[0])
base = int(data.split()[1])
n=0
while True:
  if base**n <= num:
    n+=1
  else:
    break
    
print(n)

Submission status: Accepted

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

Submission status: Accepted

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

i = 1
cnt = 0
t = 0
while n > 0:
    t = k**i - 1
    i += 1
    cnt += 1
    if n-t <= 0:
        break

print(cnt)

Submission status: Accepted

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

while max <= N:
  max = max * K
  ans  =ans + 1
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def base_10_to_n(a, b):
    if (int(a/b)):
        return base_10_to_n(int(a/b), b) + str(a%b)
    return str(a%b)

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

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