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進数で表したとき、何桁になるか
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, k))))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 初期入力
N,K = (int(x) for x in input().split(" "))
N_a = N
a =0
b =0
amari = []

while K <= N_a :
    a,b = divmod(N_a,K) 
    
    amari.append(b)
    N_a = a
amari.append(a)


print(len(amari))

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:
N, K = map(int, input().split())
i = 1
while 1:
    if N < K**i and N >= K**(i - 1):
        print(i)
        break
    i+=1

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    a, b = list(map(int, input().split()))
    d = 1
    while True:
        if b**d > a:
            break
        else:
            d += 1
    print(d)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    a, b = list(map(int, input().split()))
    flag = 1
    d = 1
    while flag:
        if b**d > a:
            flag = 0
        else:
            d += 1
    print(d)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

check_n = k
counter = 1

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

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

while(N > 0):
    ret += N%K*pow(10,i)
    N = int(N/K)
    i += 1

print(len(str(ret)))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
i = 1
while N//K != 0:
    i +=1
    N = N//K
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:
n,k=map(int,input().split())
a=[]
ans,cal=0,0

while n>=k:
    cal=n%k
    if cal!=0:
        n-=cal
    a.append(cal)
    n=n/k
a.append(1)
ans=len(a)
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)
def main():
    N,K = map(int,input().split())
    print(len(str(Base_10_to_n(N,K))))
main()

Submission status: Accepted

Solution code:
x,y = map(int,input().split())

for i in range(10000):
    k = y**i
    if k > x:
        break
print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest

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


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """11 2"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """1010101 10"""
        output = """7"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """314159265 3"""
        output = """18"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

Solution code:
import numpy as np
import math

n,k = str(input()).split()
if int(n) == 0:
    print(1)
else:
    ans = np.log(int(n))/np.log(int(k))
    print(int(ans)+1)

Submission status: Accepted

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

Submission status: Accepted

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


def solve(N: int, K: int):
    ans = 0
    while N > 0:
        N = N//K
        ans += 1

    print(ans)
    return



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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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:
NK=list(map(int,input().strip().split()))
N=NK[0]
K=NK[1]

for n in range(1,36):
    if N<K**n:
        digit=n
        break
print(digit)

Submission status: Accepted

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

i=0

while n//k**i !=0:
    i +=1

print(i)

Submission status: Accepted

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

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

print(i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(10000):
    while k**i > n:
        print(i)
        exit()

Submission status: Accepted

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

while True:
    if n >= k:
        n = n/k
        d = d + 1
    else:
        print(d)
        break

Submission status: Accepted

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

ans = 0

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


print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = fanc(n, r)
print(len(ans))

Submission status: Accepted

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

    ans = 0
    while pow(k, ans) <= n:
        ans += 1

    print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    N, K = map(int, input().split())
    cnt = 1
    while pow(K, cnt) <= N:
        cnt += 1
    print(cnt)
    return


main()

Submission status: Accepted

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

n_shin = []

tmp = n
while True:
    n_shin.append(str(tmp % k))
    tmp = int(tmp / k)
    if tmp == 0:
        break

print(len(n_shin))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num,n = map(int,input().split())
counter = 0
temp = 0
while num - n**temp >= 0:
    temp += 1
    counter +=1

print(counter)

Submission status: Accepted

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

for i in range(1, 40):
    if K**(i-1) <= N < K**i:
        print(i)
        sys.exit()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
input_list=  list(map(int, input().split()))
tmp=input_list[0]
for i in range(10**9):
    if input_list[0] >= input_list[1]**i:
        continue
    else:
        print(i) 
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(10000):
  if k**i>n:
    print(i)
    break

Submission status: Accepted

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

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:
def base10to(n, b):
    if (int(n/b)):
        return base10to(int(n/b), b) + str(n%b)
    return str(n%b)
N, K=map(int, input().split())
print(len(base10to(N,K)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

m = k
c = 1
while m-1 < n:
    m *= k
    c += 1
print (c)

Submission status: Accepted

Solution code:
number = list(map(int, input().split()))
i = 0

while number[1]**i <= number[0]:
  i += 1

print(i)

Submission status: Accepted

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

def shinsu(n,k):
    result = ''
    while n>=k:
        result += str(n%k)
        n = n//k
    result += str(n)
    return result[::-1]

print(len(shinsu(n,k)))

Submission status: Accepted

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


ans = 0
base = 1
while n >= base:
    ans += 1
    base *= k

print(ans)

Submission status: Accepted

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

print(count+1)

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)

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

Submission status: Accepted

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

cnt=0

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

print(cnt+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import math

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A,B = map(int,input().split())
cnt = 0
#print(A,B)
if A < B:
  print(A)
  exit()
while B <= A:
  A = A // B
  cnt += 1
print(cnt + 1)

Submission status: Accepted

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

print(math.ceil(x))

Submission status: Accepted

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

print(len(base10to(N, K)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
bin=0
for m in range(0,100):
  if n<k**m:
    bin=m
    break
print(bin)

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 = list(map(int,input().split()))
for i in range(100):
  if k**i <= n < k**(i+1):
    print(i+1)

Submission status: Accepted

Solution code:
#coding:utf-8
import math

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

if(int(math.log(n,k)) != math.log(n,k)):
  t1 = math.ceil(math.log(n,k))
else:
  t1 = math.ceil(math.log(n,k)) + 1

print("{}".format(t1))

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 = [int(_) for _ in input().split()]
for a in range(1, 10**9):
    N = int(N / K)
    if N <= 0:
        print(a)
        break

Submission status: Accepted

Solution code:
N, K = [int(_) for _ in input().split()]
for a in range(0, 10**9):
    if K**(a) <= N < K**(a+1):
        print(a+1)
        break

Submission status: Accepted

Solution code:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    n, k = map(int, input().split())
    d = int(math.log(n, k) + 1)
    print(1 if d == 0 else d)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
N, K = map(int,input().split())
M = ""
while True:
  M = str(N%K) + M
  N = N//K
  if N//K ==0:
    M = str(N) + M
    break
if(M[0]=="0"): M = M[1:]
print(len(M))

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

Submission status: Accepted

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

Submission status: Accepted

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

i = 0

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

ans = i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=input()
(n,m)=a.split(" ")
n=int(n)
m=int(m)
l=[]
rev=0
while n>0:
    re=n%m
    l.append(re)
    n=n//m
print(len(l))

Submission status: Accepted

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

ans = []

d = N
while d >= K:
    d, m = divmod(d, K)
    ans.insert(0, str(m))

ans.insert(0, str(d))
print(len(ans))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
digits = []
n = N
while 0 < n:
    digits.append(n % K)
    n //= K
print(len(digits))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

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

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
# K ** (X-1) =< N < K ** X -> X digits
X = 0
n = 1
while n <= N:
    X += 1
    n = n * K
print(X)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
if k == 10:
    print(len(str(n)))
else:
    if n < k:
        print(1)
        exit()
    t = n//k
    c = 1
    while t >= k:
        c += 1
        t = t//k
    print(c+1)

Submission status: Accepted

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

digit = 1
while n >= pow(k,digit):
  digit += 1

print(digit)

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

Solution code:
def digits_156_b(n: int, k:int) -> int:
    count = 0
    while n > 0:
        n = n // k
        count += 1
    return(count)

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

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:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect


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


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    n, k = LI()

    def a(n, k):
        if (n//k):
            return a(n//k, k)+str(n % k)
        return str(n % k)
    print(len(a(n, k)))
    return


# Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

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

result = 1
tmp = K

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

print(result)

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)


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

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
  
a, b = map(int, input().split(" "))

print(len(base_cvt(a,b)))

Submission status: Accepted

Solution code:
import math

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

print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
N, K = map(int, input('').split(' '))
if(N > 1):
    print(int(-(-math.log(N, K) // 1)))
else:
    print(1)

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

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

Submission status: Accepted

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

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

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())
n_k = ""
while True:
    temp = n % k
    if n != 0:
        n_k += str(temp)
    else:
        break
    n //= k
n_k = n_k[::-1]
print(len(n_k))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

i = 1
while True:
  N = N // K
  if N != 0:
    i += 1
  else:
    break
print(i)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3 ## -*- python -*-

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

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

Submission status: Accepted

Solution code:
import math

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

tmp = ''
while N > 0:
  tmp = tmp + str(N % K)
  N = math.floor(N / K)

print(len(tmp))

Submission status: Accepted

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

Submission status: Accepted

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

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

    ans = []
    n = N
    for _ in range(N):
        n, mod = divmod(n, K)
        ans.append(mod)
        if n == 0:
            break

    print(len(ans))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
if K == 10:
  print(len(str(N)))
else:
  res = 1
  KK = K
  while KK <= N:
    res += 1
    KK *= K
  print(res)

Submission status: Accepted

Solution code:
import numpy as np

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

max_base = [30, 22, 15, 14, 13, 12, 11, 10, 9]
base = np.array([i for i in range(max_base[K-2])])

base = K**base

target = np.array([N]*max_base[K-2])

index = np.where(base <= target, 1, 0)

print(np.sum(index))

Submission status: Accepted

Solution code:
#ABC156:B_Digits

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

i = 1

while N//(R**(i)) > 1:
    if N//(R**(i+1)) == 0:
        break
    i += 1

if N//(R**i) == 0:
    print(i)
else:
    print(i + 1)

Submission status: Accepted

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

N_ = N
digits = 0
i = 0
while N_ / K >= K:
  digits += (10 ** i) * (N_ % K)
  N_ = int(N_ / K)
  i += 1

N_ = int(N_ / K)
digits += (10 ** (i + 1)) * (N_ % K)

print(len(str(digits)))

Submission status: Accepted

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

Submission status: Accepted

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


c = 0 # グルーバル変数
# nが0になるまで割る
def cnt(num, radix):
    x = num // radix
    global c 
    c += 1
    if x == 0:
        return c
    else:
        return cnt(x, radix)

cnt(n, k)
print(c)

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

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

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

Submission status: Accepted

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

print(c)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
n, k= map(int, input().split())
count=0
i=n//k
if n>=k:
  while i>=k:
    i=i//k
    count=count+1
  print(int(count)+2)
else:
  print(1)

Submission status: Accepted

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

for i in range(10000):
    n_min = k ** (i - 1)
    n_max = k ** i
    if n_min <= n and n_max > n:
        print(i)
        break

Submission status: Accepted

Solution code:
import math

def main():
    N, K = map(int, input().split())
    print(int(math.log(N) / math.log(K)) + 1)
    return


main()

Submission status: Accepted

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


main()

Submission status: Accepted

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

n = int(NKlist[0])
k = int(NKlist[1])

count = 0

for i in range(50):
    if n >= k**i:
        count = count + 1
    else:
        break

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

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    n,k = map(int,input().split())
    eprint('math.log(n,k) ', end=':\n')
    eprint(math.log(n,k))
    d = math.ceil(math.log(n,k))
    print(1 if d ==0 else d)

if __name__ == '__main__':
    main()