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: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np
import math

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

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

print int(math.ceil(log_K))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
import math

N, K = map(int, input().split())
print(math.ceil(math.log(N,K)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(31):
    if k**i-1 > n:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
n, r = map(int, input().split())
for i in range(1, 100000000000):
  if r ** (i - 1) <= n <= r ** i:
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
import math

N, K = map(int, input().split())
count = 0
now = 1
while True:
    if N <= now:
        break
    else:
        count += 1
        now *= K
        
print(count)

Submission status: Wrong Answer

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    n, k = map(int, args[0].split())

    ret = 0
    while 1 < n/(k**ret):
        ret += 1
    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#coding:utf-8

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

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

Submission status: Wrong Answer

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

import math
print(math.ceil(math.log(x,k)))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
N, K = [int(x) for x in input().strip().split()]
cnt = 1
c = K
while c < N:
    c *= K
    cnt += 1

print(cnt)

Submission status: Wrong Answer

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

res=K
ans=1
for i in range(1,N):
    if res>=N:
        print(ans)
        exit()
    res*=K
    ans+=1

Submission status: Wrong Answer

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

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

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

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

print(ceil(log(N, K)))

Submission status: Wrong Answer

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

N,K=map(int,input().split())
print(math.ceil(math.log(N,K)))

Submission status: Wrong Answer

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

dig = 0
while True:
  if n > pow(k,dig):
    dig += 1
  else:
    break
print(dig)

Submission status: Wrong Answer

Solution code:
from math import ceil, log

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

Submission status: Wrong Answer

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

i = 0
while True:
    s = k ** i
    if n / s > 1:
        i += 1
        continue
    else:
        break
print(i)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def MI() : return map(int, input().split())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args) : names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}; print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

N, K = MI()

print(math.ceil(math.log(N, K)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
a, k = input().split()
print(math.ceil(math.log(int(a), int(k))))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

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

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math

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

print(math.ceil(math.log(N,K)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

n, k = map(int, input().split())
ans = math.log(n, k)

print(math.ceil(ans))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

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


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K):
    n = math.log(N, K)
    return math.ceil(n)


def main():
    N, K = read_int_n()
    print(slv(N, K))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b=list(map(int, input().split()))
from math import log
if int(log(a,b))==log(a,b):
  print(int(log(a,b)))
else:
  print(int(log(a,b)+1))

Submission status: Wrong Answer

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

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

l = list(map(int, input().split()))

cnt =1
while l[0]>l[1]:
    l[0]/=l[1]
    cnt +=1
print(cnt)

Submission status: Wrong Answer

Solution code:
import math

def logx(x,y):
    return math.ceil(math.log(x) / math.log(y))

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

print(logx(N,K))

Submission status: Wrong Answer

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

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

print(res)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math


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

ans = math.ceil(math.log(N)/math.log(K))
print(ans)

Submission status: Wrong Answer

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k = LI()
cnt = 0
tmp = 1
while tmp < n:
    tmp *= k
    cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
from math import log, ceil


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
for i in range(10000):
  if p**i<=n<p**(i+1):
    print(i-1)
    exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
n,r=list(map(int,input().split()))
ans=math.log(n,r)
ans=math.ceil(ans)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math
def input():
	return stdin.readline()[:-1]

def intput():
	return int(input().rstrip())

def sinput():
	return input().rstrip().split()

def intsput():
	return map(int, sinput())

def main():
	n, k = intsput()
	print(int(math.ceil(math.log(n, k))))



if __name__ == '__main__':
	main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
s, k = map(int,input().split())
c = list()
while s >= 0:
    a = s % k
    c.append(a)
    s = s // k

print(len(c))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

def main():
    strA = input()
    listA = strA.split(" ")

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

    x = N
    y = 0
    while(1):
        x = math.floor(x/K)

        y = y + 1
        if(x < K and x != 0):
            y = y + 1
            break

    print(y)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for i in range(2**n):
    # if k ** (i - 1) - 1 < n <= k ** i - 1:
    if n <= k ** i - 1:
        print(i)
        exit()

Submission status: Time Limit Exceeded

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

for i in range(2**n):
    if k ** (i - 1) - 1 < n <= k ** i - 1:
        print(i)
        exit()

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
i=1
#N進数m桁であらわせる最大値はN**m-1
j=int(k**i)

import sys

while True:

    if n <=(j-1):

        print(i)

        sys.exit()

    else:
        i+=1
        pass

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

while True:
    if n >= k: 
        n //= k
        ans += 1
    elif n <= 1: break

print(ans+1)

Submission status: Time Limit Exceeded

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

while True:
    if n >= k: 
        n //= k
        ans += 1
    if n <= 1: break

print(ans+1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
a = [int(i) for i in input().split()]
# N:整数　K:進数
N = a[0]
K = a[1]
i = 0
while True:
    i += 1
    if K**i <= N <= K**(i+1)-1:
        print(i+1)
        break

Submission status: Time Limit Exceeded

Solution code:
a = [int(i) for i in input().split()]
# N:整数　K:進数
N = a[0]
K = a[1]
#print(N, K)
i = 0
while True:
    i += 1
    #print(f'桁{i+1}  桁数繰上り {K**i} ～ {K**(i+1)-1}')
    min_num = K**i
    max_num = K**(i+1)-1
    keta = i+1
    if min_num <= N and N <=max_num:
        print(keta)
        break

Submission status: Time Limit Exceeded

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

x = 0

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

Submission status: Time Limit Exceeded

Solution code:
N,K = input().split()
N1 = int(N)
K1 = int(K)
for i in range (1000000):
    if K1**(i-1) <= N1 and N1 < K1**i:
        print(i)

Submission status: Time Limit Exceeded

Solution code:
N,R=map(int, input().split())
i=0
while True:
 if(0<N-R**(i+1)<=R**i):
  print(i+2)
  break
 i+=1

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 1

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

print(digit)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys

inp = input()
N = int(inp.split()[0])
R = int(inp.split()[1])

i = 0
s=0
l=R

while True:
  s = l
  l = s*R
  if s < N and N < l:
     print(i+2)
     break
  i += 1

Submission status: Time Limit Exceeded

Solution code:
inp = input()
N = int(inp.split()[0])
R = int(inp.split()[1])
 
i = 0
s=0
l=0
while True:
  if i==0:
    s=0
    l=R
  else:
  	s = l
  	l = s*R
  if s < N and N < l:
     print(i+1)
     break
  i += 1

Submission status: Time Limit Exceeded

Solution code:
def main():
    N,K=map(int,input().split())
    keta=1
    flag=0
    A=K
    while flag==0:
        if A<=N and A*K>N:
            print(keta+1)
            return
        A*=K
        keta= keta+1
main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N,K=map(int,open(0).read().split())
    keta=1
    flag=0
    A=K
    while flag==0:
        if A<=N:
            if A*K>N:
                print(keta+1)
                return
        A*=K
        keta= keta+1
main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N,K=map(int,open(0).read().split())
    keta=1
    flag=0
    while flag==0:
        if pow(K,keta)<=N and pow(K,keta+1)>N:
            print(keta+1)
            return
        keta= keta+1
main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N,K=map(int,open(0).read().split())
    keta=1
    flag=0
    A=K
    while not (A<=N and A*K>N):
        A*=K
        keta= keta+1
    print(keta+1)
main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N,K=map(int,open(0).read().split())
    keta=1
    flag=0
    A=K
    while flag==0:
        if A<=N and A*K>N:
            print(keta+1)
            return
        A*=K
        keta= keta+1
main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N,K=map(int,open(0).read().split())
    keta=1
    flag=0
    A=K**keta
    while flag==0:
        if A<=N and A*K>N:
            print(keta+1)
            return
        A*=K
        keta= keta+1
main()

Submission status: Time Limit Exceeded

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

cnt = 0
while True:
  n //= k
  cnt += 1
  if n == k:
    cnt += 2
    break
    
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
inp = input()
N = int(inp.split()[0])
R = int(inp.split()[1])

i = 0
while True:
  s = R**i
  l = R**(i+1)
  if s < N and N < l:
     print(i+1)
     break
  i += 1

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    N,K=map(int,open(0).read().split())
    keta=1
    flag=0
    while flag==0:
        if K**keta<=N and K**(keta+1)>N:
            print(keta+1)
            return
        keta= keta+1
main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N,K=map(int,open(0).read().split())
    keta=1
    flag=0
    while flag==0:
        if K**keta<=N and K**(keta+1)>N:
            flag=1
        keta= keta+1
        #print(keta)

    print(keta)
main()

Submission status: Time Limit Exceeded

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

for i in range(10**9):
    if k**i < n and n < k**(i + 1):
        cnt = i + 1
        break

print(cnt)

Submission status: Time Limit Exceeded

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


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

import sys


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

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


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

ans = 0
count = 1

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

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

Submission status: Accepted

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

Submission status: Accepted

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

# kのべき乗でnを超える最大の冪数を求める
# 最大の冪数から順にとり尽くしていく
# 再帰で書ける？

def max_beki(number, k):
    beki = 0
    while k**beki <= number:
        beki += 1
    return beki

res = []
waru_kazu = k**(max_beki(n, k) - 1)
while waru_kazu >= 1:
    shou = n//waru_kazu
    res.append(str(shou))
    n -= shou*waru_kazu
    waru_kazu /= k

print(len(res))

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
l = []
while n != 0 :
    r = divmod(n,k)
    n = r[0]
    l.append(r[1])
print(len(l))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
# NをK進数に変換
digits = ''
while N >= 1:
  digits += str(N % K)
  N //= K

print(len(digits))

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())
count = 0
a = int(N / K)
while a > 0:
  a = int( a / K ) 
  count += 1
print( count + 1 )

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
cnt = 0
while i <= n:
    i *= k
    cnt += 1
print(cnt)

Submission status: Accepted

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

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

print(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:
import queue
N,K = map(int,input().split())
ans = queue.Queue()
while N >= K:
    N,amari = divmod(N,K)
    ans.put(amari)
ans.put(N)
answer = ""
while not ans.empty():
    answer += str(ans.get())
print(len(answer))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def answer(n: int, k: int) -> int:
    digits = 0
    while 0 < n:
        n //= k
        digits += 1

    return digits


def main():
    n, k = map(int, input().split())
    print(answer(n, k))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def L():
  return list(map(int, input().split()))
import math
[n,k]=L()

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

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:
def resolve():
	n,k = map(int,input().split())
	ans  = 0
	while n!=0:
		n = n//k
		ans += 1
	print(ans)
resolve()

Submission status: Accepted

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

while True:
    if n>=k:
        total.append((n%k))
        n=n//k
    if n<k:
        total.append((n))
        break
print(len(total))

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

i = 0
anslist = []
while True:
  if N>=K:
    i+=1
    anslist.append(N%K)
    N = N//K
    #print (N)
  if N<K:
    anslist.append(N)
    i+=1
    break
    
anslist.reverse()
#print (anslist)
#print (''.join(map(str, anslist)))
print (i)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
# Nが十進数のとき、NよりKのi乗が超えた数のとき、
# iがK進数の桁数
for i in range(10 ** 9):
    if N < K ** i:
        print(i)
        break

Submission status: Accepted

Solution code:
n = input()
n = n.split()
k = int(n[1])
n = int(n[0])
a = 1
b = 0
while a == 1:
    b = b + 1
    if k**b>n:
        a = 0
print(b)

Submission status: Accepted

Solution code:

n,k = map(int, input().split())
i=0
a=[]

while n!=0:
    a.append(n%k)

    n=n//k
    i=i+1

print(len(a))

Submission status: Accepted

Solution code:
def base10toK_base(num, K):
    if num // K:
        return base10toK_base(num//K, K) + str(num % K)
    return str(num % K)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#https://atcoder.jp/contests/abc156/tasks/abc156_b
N,K = map(int,input().split())
q, mod = divmod(N,K)
mod_list = [mod]
while True:
    q , mod =divmod(q,K)
    mod_list.append(mod)
    if q <=0 :
        break

n_ary = int("".join(map(str,mod_list[::-1])))
print(len(str(n_ary)))