Problem:


Score : 300 points

Problem Statement

You are given an integer N.

For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.

For example, F(3,11) = 2 since 3 has one digit and 11 has two digits.

Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.

Constraints

1 \leq N \leq 10^{10}

N is an integer.

Input

The input is given from Standard Input in the following format:

N

Output

Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.

Sample Input 1

10000

Sample Output 1

3

F(A,B) has a minimum value of 3 at (A,B)=(100,100).

Sample Input 2

1000003

Sample Output 2

7

There are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.

Sample Input 3

9876543210

Sample Output 3

6



Sample input:
10000


Sample output:
3

Submission status: Accepted

Solution code:
from math import sqrt

n = int(input())

m = 1
for i in range(2, int(sqrt(n)+1)):
    if n % i == 0:
        m = i

print(len(str(n // m)))

Submission status: Accepted

Solution code:
import math

N=int(input())
for a in range(int(math.sqrt(N)),1,-1):
    b, mod=divmod(N,a)
    if mod==0:
        print(len(str(max([a,b]))))
        break
else:
    print(len(str(N)))

Submission status: Accepted

Solution code:
n=int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

import math
ans=len(str(n))
for i in range(1,int(math.sqrt(n))+1):
    if n%i==0:
        ans=max(len(str(i)),len(str(n//i)))

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
n = round(N ** 0.5)
m = 12
for i in range(1, n + 1):
    if N % i == 0:
        j = N // i
        #print('{0} , {1}'.format(i,j))
        m = min(max(len(str(i)),len(str(j))),m)
print(m)

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
N_original = N
N_a_m = int(np.floor(N**(0.5)))


for i in range(1,N_a_m+1):
    j = N_a_m+1 - i
    if N%j == 0:
        N_A = j
        break


    
N_B = len(str(int(N_original/N_A)))
        
print(N_B)

Submission status: Accepted

Solution code:
N = int(input())

def cKeta(A):
    return(len(str(A)))

th = round(N ** 0.5)
minketa = 12
for i in range(1,th+1):
    if N % i == 0:
        keta = max(cKeta(i),cKeta(N//i))
        if keta < minketa:
            minketa = keta
            
print(minketa)

Submission status: Accepted

Solution code:
n=int(input())
t=[]
for a in range(1,int((n)**0.5)+1):
    if n%a==0:
        b=n/a
        t.append(max(len(str(int(a))),len(str(int(b)))))
        
print(min(t))

Submission status: Accepted

Solution code:
N = int(input())

def F(a, b):
    return max( len(str(a)), len(str(b)) )

ans = float('inf')
n_iter = int(N**(1/2))+1

for i in range(1, n_iter):
    if N%i==0:
        ans = min( ans, F(i, N//i) )

print(ans)

Submission status: Accepted

Solution code:
import sys
import math

n = int(input())

min_func = -1
for a in range(1, math.ceil(math.sqrt(n)) + 1, 1):
    if n % a != 0:
        continue
    else:
        b = int(n / a)
        if min_func == -1:
            min_func = max(len(str(a)), len(str(b)))
        else:
            if min_func > max(len(str(a)), len(str(b))):
                min_func = max(len(str(a)), len(str(b)))

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

Submission status: Accepted

Solution code:
from math import sqrt

N = int(input())
count = 0
for i in range(int(sqrt(N)), 0, -1):
    if N % i == 0:
        smallA = i
        break

bigA = N / smallA

while True:
    bigA /= 10
    count += 1
    if bigA < 1:
        break
print(count)

Submission status: Accepted

Solution code:
#coding utf-8
import math
N = int(input())

for i in range(int(math.sqrt(N))+1,0,-1):
    if N % i == 0:
        a = i
        b = N // i
        break

print(max(len(str(a)),len(str(b))))

Submission status: Accepted

Solution code:
n = int(input())
ans = float("inf")
for i in range(1,int(n**0.5)+1):
  if n%i == 0:
    ans = min(ans,max(len(str(i)), len(str(n//i))))
print(ans)

Submission status: Accepted

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

def K(n):
  a=0
  while n>0:
    n=n//10
    a=a+1
  return a

n=int(input())
D=make_divisors(n)
print(K(D[len(D)//2]))

Submission status: Accepted

Solution code:
def f(a, b):
    a_len = len(str(a))
    b_len = len(str(b))
    if a_len > b_len:
        return a_len
    else:
        return b_len


def get_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors


def main():
    n = int(input())

    f_min = 11
    divisors = get_divisors(n)
    for i in divisors:
        for j in divisors:
            if i * j == n:
                f_min = min(f_min, f(i, j))
    print(f_min)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
ans=10**9
for i in range(1,int(n**0.5)+2):
  if n%i==0:
    ans=min(ans,max(len(str(i)),len(str(n//i))))
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = 10
for A in range(1, int(math.sqrt(N))+1):
  if N % A == 0:
    B = N//A
    F = max(len(str(A)), len(str(B)))
    if ans > F:
      ans = F 
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = N
for i in range(1, int(math.sqrt(N))+1):
    if N % i == 0:
        a, b = i, N//i
        c = max(a, b)
        if c < ans:
            ans = c
print(len(str(ans)))

Submission status: Accepted

Solution code:
x=int(input())
chk=0
ans=0
for i in range(1,(round(x**0.5)//1)+1):
	if x%i==0:
		chk=i
ans=x//chk
for i in range(10):
	if 10**i<=ans and 10**(i+1)>ans:
		print(i+1)
		break

Submission status: Accepted

Solution code:
n = int(input())

x = 10**10
for i in range(1, int(n**0.5)+1):
    if n % i == 0:
        x = min(x, max(len(str(i)), len(str(n//i))))

print(x)

Submission status: Accepted

Solution code:
n = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

li = make_divisors(n)
ans = 10**10

for i in range(len(li) // 2):
    a = li[i*2]
    b = li[i*2+1]
    ans = min(ans, max(len(str(a)), len(str(b))))

if len(li) % 2 == 1:
    ans = min(ans, len(str(li[-1])))

print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())

F = len(str(N))
for i in range(1, int(math.sqrt(N))+1):
    if N % i == 0:
        j = int(N / i)

        tmp = max(len(str(i)), len(str(j)))
        if tmp < F:
            F = tmp

print(F)

Submission status: Accepted

Solution code:
def f(a, b):
    return max(len(str(a)), len(str(b)))

N = int(input())
cnt = 2
ret = len(str(N))
while cnt * cnt <= N:
    if N % cnt == 0:
        ret = min(ret, f(cnt, N//cnt))
    cnt += 1

print(ret)

Submission status: Accepted

Solution code:
N = int(input())

F_list = []
for i in range(1, int(N**(1/2))+1):
  if N % i == 0:
    A = i
    B = N // A
    F = max(len(str(A)), len(str(B)))
    F_list.append(F)

print(min(F_list))

Submission status: Accepted

Solution code:
N = int(input())

ans = float("inf")
for i in range(1, int(N ** (1/2)) + 1):
    if N % i == 0:
        ans = min(ans, max( len(str(i)), len(str(N // i))))
print(ans)

Submission status: Accepted

Solution code:
import math 
N = int(input())
F = len(str(N))
for i in range(int(math.sqrt(N)) + 1):
    if N % (i+1) == 0:
        F = len(str(N // (i+1)))

print(F)

Submission status: Accepted

Solution code:
import math
n = int(input())

min_n = n

for i in range(1,int(math.sqrt(n))+1):
    if n % i == 0:
        a = len(str(i))
        b = len(str(int(n/i)))
        
        if min_n > max(a,b):
            min_n = max(a,b)


print(min_n)

Submission status: Accepted

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append((i, n // i))

    return divisors

def resolve():
    N = int(input())

    divisors = make_divisors(N)
    ans = 1<<60
    for a, b in divisors:
        s_a = len(str(a))
        s_b = len(str(b))
        if s_a <= s_b:
            ans = min(ans, s_b)
        else:
            ans = min(ans, s_a)
    return print(ans)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
n = int(input())
ans = float('inf')
for b in range(int(n ** 0.5) + 1, 0, -1):
    if n % b == 0:
        a = n // b
        ma = max(a, b)
        ans = min(ans, ma)
print(len(str(ans)))

Submission status: Accepted

Solution code:
N=int(input())
ans=10**5
for i in range(1,int(N**0.5+1)):
    if N%i==0:
        ans=min(ans,max(len(str(N//i)),len(str(i))))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 11
for i in range(1, int(-(-n**.5//1))+1):
    x, r = divmod(n, i)
    if r == 0:
        ans = min(ans, max(map(lambda x: len(str(x)), (i, x))))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


fact = factorization(n)
ans = 0
it = []
for x, cnt in fact:
    for _ in range(cnt):
        it.append(x)


def dfs(n, a, b):
    if n == 0:
        return max(map(lambda x: len(str(x)), (a, b)))
    else:
        x1 = dfs(n-1, a*it[n-1], b)
        x2 = dfs(n-1, a, b*it[n-1])
        return min(x1, x2)


print(dfs(len(it), 1, 1))

Submission status: Accepted

Solution code:
N=int(input())
a=12
for i in range(10**5+1):
 if N%(i+1)==0 and N>=(i+1):
  j=int(N/(i+1))
  k=max(len(str(i+1)),len(str(j)))
  a=min(a,k)
print(a)

Submission status: Accepted

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

N = int(input())
D = make_divisors(N)
L = len(D)
if L%2==0:
    print(len(str(D[L//2])))
else:
    print(len(str(D[L//2])))

Submission status: Accepted

Solution code:
MAX_PRIME = 10**5 + 10
is_prime = [1] * MAX_PRIME
primes = []
is_prime[0] = 0
is_prime[1] = 0
for i in range(MAX_PRIME):
    if is_prime[i]:
        primes.append(i)
        for j in range(2, ((MAX_PRIME-1)//i) + 1):
            is_prime[i*j] = 0

def factorization(n):
    factor = {}
    for p in primes:
        if p ** 2 > n:
            break
        while n % p == 0:
            n //= p
            if p not in factor:
                factor[p] = 1
            else:
                factor[p] += 1
    if n > 1:
        factor[n] = 1
    return factor

n = int(input())

f = factorization(n)

def F(a, b):
    return max(len(str(a)), len(str(b)))

k = sorted(list(f.keys()))
def dfs(num, i):
    if i < len(k):
        m = 10 ** 18
        p = k[i]
        for j in range(f[p]+1):
            m = min(m, dfs(num * p ** j, i+1))
        return m
    return F(num, n // num)

print(dfs(1, 0))

Submission status: Accepted

Solution code:
import math
def resolve():
    x = int(input())
    a = 0
    b = 0
    for i in range(1, x):
        if i >math.sqrt(x):
            break
        if x % i == 0:
            a = i
            b = x // a

    print(len(list(str(b))))

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import math
a = int(input())
l = []
for i in range(1,int(math.sqrt(a))+1):
    if a % i == 0:
        l.append(i)
k = l[-1]
k2 = a//k
if k < k2:
    print(len(str(k2)))
else:
    print(len(str(k)))

Submission status: Accepted

Solution code:
import math

N = int(input())

sqrtn = math.ceil(math.sqrt(N))
res = len(str(N))
for A in range(sqrtn,1,-1):
    if(N % A != 0):
        continue
    B = N//A
    
    tmpres = max(len(str(A)), len(str(B)))
    res = min(res, tmpres)
print(res)

Submission status: Accepted

Solution code:
n = int(input())

def F(a: int, b: int) -> int:
    la, lb = len(str(a)), len(str(b))
    if la <= lb:
        return lb

    return la

ans = F(1, n)
for i in range(2, int(n**0.5)+1):
    if n%i == 0:
        ans = min(ans, F(i, n//i))

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 100
i = 1
while i*i <= N:
  if N % i == 0:
    f = len(str(max(i, N//i)))
    ans = min(f, ans)
  i += 1

print(ans)

Submission status: Accepted

Solution code:
import math
N=int(input())
# rootを求める
# 二分探索すればいいのか！！！
root_n = int(math.sqrt(N))
up_n = root_n
up_ans = 0
keta = lambda x: len(str(x))
while up_n <= N:
  if N % up_n == 0:
    pair = int(N/up_n)
    # 桁数を求める
    up_ans = max(keta(pair), keta(up_n))
    break
  else:
    up_n-=1

print(up_ans)

Submission status: Accepted

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

import math
N=int(input())
INF = 3000000
# rootを求める
# 二分探索すればいいのか！！！
ans = INF
pairs = make_divisors(N)
keta = lambda x: len(str(x))
for pair in pairs:
  tmp_ans = max(keta(pair), keta(int(N/pair)))
  ans = min(ans,tmp_ans)

print(ans)

# root_n = int(math.sqrt(N))
# up_n = root_n
# up_ans = 0

# while up_n <= N:
#   if N % up_n == 0:
#     pair = int(N/up_n)
#     # 桁数を求める
    
#     break
#   else:
#     up_n+=1

# print(up_ans)

Submission status: Accepted

Solution code:
n = int(input())

element = []
i = 1
while  i * i <= n:
    if n % i == 0:
        element.append([len(str(i)),len(str(n//i))])
    i += 1
ans = max(element[0][0],element[0][1])
for i in range(len(element)):
    ans = min(max(element[i][0],element[i][1]),ans)
print(ans)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

n = int(input())

def divisors(n):
    div = []
    i = 1
    while(i * i <= n):
        if n % i == 0:
            div.append(i)
            if i * i != n:
                div.append(n // i)
        i += 1
    return div

def f(a, b):
    al = len(str(a))
    bl = len(str(b))
    
    if al > bl:
        return al
    else:
        return bl

cand = divisors(n)

m =float('inf')

for a in cand:
    b = n // a
    c = f(a, b)
    if  c < m:
        m = c

print(c)

Submission status: Accepted

Solution code:
n = int(input())
cnt = int(n ** (1/2))
nums = []
for i in range(1,cnt+1):
    if n % i == 0:
        nums.append(i)
    else:
        pass
ans = n // nums[-1]
print(len(str(ans)))

Submission status: Accepted

Solution code:
N = int(input())
ans = 1
for i in range(1,N):
  if N % i == 0:
    ans = max(len(str(i)), len(str(N//i)))
  if N//i and i > N//i:
    break
print(ans)

Submission status: Accepted

Solution code:
#date: 2020-03-17 15:13
import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n = ni()
    i = 1
    while i * i <= n:
        if n % i == 0:
            j = n // i
            ans = max(len(str(i)), len(str(j)))
        i += 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
n = int(input())

ans = []
for i in range(1, int(math.sqrt(n))+1):
  if n % i == 0:
    ans.append(max(len(str(i)), len(str(n//i))))
    
print(min(ans))

Submission status: Accepted

Solution code:
from math import log10
n = int(input())
ans = []
for i in range(1, int(n**0.5+1)):
    if n%i == 0:
      spt1 = i
      spt2 = n//i
      ans.append(max(spt1, spt2))
print(int(log10(min(ans)))+1)

Submission status: Accepted

Solution code:
def make_divisors(n):
    ans = float("inf")
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            div1 = i
            div2 = n // i
            res = max(len(str(div1)), len(str(div2)))
        ans = min(ans, res)
    return ans

if __name__ == '__main__':
    n = int(input())
    print(make_divisors(n))

Submission status: Accepted

Solution code:
import math
n = int(input())

d = 0
for i in range(1, int(math.sqrt(n)) + 1):
    if not n % i:
        d = n / i

print(len(str(int(d))))

Submission status: Accepted

Solution code:
def longer_length(x, y):
    len_x, len_y = len(str(x)), len(str(y))
    if len_x > len_y:
        return len_x
    return len_y


def main():
    N = int(input())
    min_odd = longer_length(N, 1)
    for n in range(2, int(N ** 0.5)+1):
        if N % n == 0:
            i = longer_length(n, N // n)
            if i < min_odd:
                min_odd = i
    print(min_odd)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
li=[]

for i in range(1,10**5):
  if n%i==0:
    a=i
    b=n//a
    f=max(len(str(a)),len(str(b)))
    li.append(f)
print(min(li))

Submission status: Accepted

Solution code:
# coding: utf-8

#桁数判定
def num_of_digits(n):
    digit = 0
    #nが0になるまで
    while n > 0:
        n //= 10
        digit += 1
    return digit

#main
N = int(input())
F = []

i = 1
while i * i <= N:
    if N % i == 0:
        F.append(max(num_of_digits(i), num_of_digits(N//i)))
    i += 1

print(min(F))

Submission status: Accepted

Solution code:
N = int(input())
ans = N
def F(a,b):
    return max([len(str(i))for i in [a,b]])
for i in range(1,N+1):
    if i*i>N:break
    if N%i==0:
        a,b = i,N//i
        ans = min(ans,F(a,b))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

fmin = 100100100100
for i in range(1, 1+int(n**0.5)+1):
  if n % i == 0:
    f = len(str(n//i))
    if f < fmin:
      fmin = f

print(fmin)

Submission status: Accepted

Solution code:
n = int(input())
ele = []
i = 1
while i * i <= n:
    if n % i == 0:
        ele.append([len(str(i)),len(str(n // i))])
    i += 1

k = max(ele[0][1],ele[0][0])
for i in range(len(ele)):
    k = min(max(ele[i][0],ele[i][1]),k)
print(k)

Submission status: Accepted

Solution code:
def calc_digit(n):
    digit = 0
    while n > 0:
        digit += 1
        n //= 10
    return digit

def main():
    N = int(input())
    i = 1
    digit = []
    ans = 10
    while i ** 2 <= N:
        if N % i == 0:
            tmp = calc_digit(N // i)
            if ans > tmp:
                ans = tmp
        i += 1
    print(ans)

    return 0


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def func(a,b):
    digit_a=len(str(a))
    digit_b=len(str(b))
    if digit_a>=digit_b:
        return digit_a
    else:
        return digit_b

N=int(input())

INF=float('inf')
ans=INF


for i in range(1,int(N**0.5)+1):
    if N%i==0:
        ans=min(ans,func(i,N//i))

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
n2=int(n**0.5)
ans=0

for i in range(1,n2+1):
    if n%i==0:
        ans=len(str(n//i))
        
print(ans)

Submission status: Accepted

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            divisors.append(n//i)
    return divisors

N = int(input())
divisors = make_divisors(N)
ans = 11
for i in range(0, len(divisors), 2):
    d1 = int(math.log10(divisors[i]))+1
    d2 = int(math.log10(divisors[i+1]))+1
    ans = min(ans, max(d1, d2))
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
n=len(str(N))
m=(n//2)
def wari(x):
    array=[]
    if m==0:
        for j in range(9,0,-1):
            if N%j==0:
                c=max(len(str(N//j)),len(str(j)))
                array.append(c)
                break
        
    for i in range(m+1):
        if i==0:
            for j in range(9,0,-1):
                if N%j==0:
                    c=max(len(str(N//j)),len(str(j)))
                    array.append(c)
                    break
        else:
            for j in range((10**(i+1))-1,(10**i)-1,-1):
                if N%j==0:
                    c=max(len(str(N//j)),len(str(j)))
                    array.append(c)
                    break
    return min(array)
print(wari(N))

Submission status: Accepted

Solution code:
import math

N=int(input())
start=math.floor(math.sqrt(N))
for i in range(start,1,-1):
    if (N%i==0):
        print(len(str(max(i,N//i))))
        break
else:
    print(len(str(N)))

Submission status: Accepted

Solution code:
N=int(input())
import math
rootN=math.sqrt(N)
if rootN==int(rootN):
    n=int(rootN)
else:
    for m in reversed(range(1,int(rootN)+1)):
        if N%m==0:
            n=int(N/m)
            break
print(len(str(n)))

Submission status: Accepted

Solution code:
#ABC057
import math
n = int(input())
#print(math.sqrt(n))
m = len(str(n))
for i in range(1,int(math.sqrt(n))+1):
    if n % i == 0:
        #print(i,n//i)
        #print(len(str(i)),len(str(n//i)))
        if m > len(str(n//i)):
            m = len(str(n//i))
print(m)

Submission status: Accepted

Solution code:
from math import sqrt,ceil
n = int(input())
val = ceil(sqrt(n))
ans = int(1e10) + 7
for i in range(1,val + 1):
    if n % i == 0:
        ans = max(len(str(i)),len(str(n//i)))
print(ans)

Submission status: Accepted

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

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

def main():
    mod=10**9+7
    N=I()
    
    def F(a,b):
        na=len(str(a))
        nb=len(str(b))
        return max(na,nb)
    
    def make_divisors(n):
        divisors = []
        for i in range(1, int(n**0.5)+1):
            if n % i == 0:
                divisors.append(i)
                if i != n // i:
                    divisors.append(n//i)

        # divisors.sort()
        return divisors
    
    L=make_divisors(N)
    ans=10**10
    for i in range(len(L)):
        a=L[i]
        b=N//L[i]
        temp=F(a,b)
        ans=min(ans,temp)
        
    print(ans)
        
        

main()

Submission status: Accepted

Solution code:
def large_digits(A, B):
    return max(len(str(A)), len(str(B)))

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def main():
    N = int(input())
    divs = make_divisors(N)
    # loop = len(divs) // 2 + 1
    ans = 10**10 + 1
    for d in divs:
        ans = min(ans, large_digits(d, N // d))
    # print(divs)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import math
def main():
    N = int(input())
    ans = len(str(N))
    for i in range(1, math.ceil(math.sqrt(N))+1):
        if N % i == 0:
            tmp = max(len(str(i)), len(str(N // i)))
            if ans > tmp:
                ans = tmp
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from fractions import gcd
def main():
    N = int(input())
    ans = len(str(N))
    for i in range(len(str(N)) // 2 + 1):
            for j in reversed(range(10**i, 10**(i+1))):
                if N % j == 0:
                    tmp = max(len(str(j)), len(str(N // j)))
                    if ans > tmp:
                        ans = tmp
                    break
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
import math
sqrt_n = int(math.sqrt(n)) + 1

div = len(list(str(n)))

for v in range(1,sqrt_n):
    if n%v == 0:
        b = int(n / v)
        a_div = len(list(str(v)))
        b_div = len(list(str(b)))
    
        if a_div < b_div:
            if div >= b_div:
                div = b_div
        else:
            if div >= a_div:
                div = a_div
print(div)

Submission status: Accepted

Solution code:
n=int(input())
m=int(n**.5)+1
ans=[]
for a in range(m, 0, -1):
    b=n//a
    if a*b==n:
        ans.append(max(len(str(a)),len(str(b))))
print(min(ans))

Submission status: Accepted

Solution code:
import math

n = int(input())
a = math.ceil(n**0.5)
ans = 10000000000000000000000000

for i in range(1,a+1):
    if n % i == 0:
        r = int(n/i)
        ans = min( ans , max(len(str(i)) , len(str(r))))
        
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ab_lst = []
for i in range(1, int(n**0.5)+1):
    if n % i == 0:
        ab_lst.append([i, n // i])
# print(ab_lst)
ans = 20
for i in range(len(ab_lst)):
    a = ab_lst[i][0]
    b = ab_lst[i][1]
    if a < b: f = len(str(b))
    else: f = len(str(a))
    # print(a, b, f)
    if f < ans:
        ans = f
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

def sum_order(a, b):
    return max(len(str(a)), len(str(b)))

f_min = sum_order(1, n)
limit = int(pow(n, 1 / 2))
for i in range(2, limit + 1):
    if n % i == 0:
        f = sum_order(i, n // i)
        f_min = min(f_min, f)

print(f_min)

Submission status: Accepted

Solution code:
n = int(input())
tmp = 10
for i in range(1,int(n**0.5)+1):
    if n%i == 0:
        tmp = min(tmp, max(len(str(i)), len(str(int(n/i)))))
print(tmp)

Submission status: Accepted

Solution code:
import math
n=int(input())
ans=len(str(n))
for i in range(1,int(math.sqrt(n))+2):
  if n%i==0:
    ans=min(ans,max(len(str(i)),len(str(n//i))))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
for i in range(int(n ** 0.5), 0, -1):
    if n % i == 0:
        print(len(str(n // i)))
        break

Submission status: Accepted

Solution code:
n = int(input())
ans = float('inf')
for i in range(1, 100001):
    if n % i == 0:
        ans = min(ans, max(len(str(i)), len(str(n // i))))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 11

for i in range(1, 100001):
    if N % i == 0:
        ans = min(ans, max(len(str(i)), len(str(N // i))))

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 10
i = 1


def dig(n):
    ret = 0
    while n > 0:
        ret += 1
        n //= 10
    return ret


while i*i <= n:
    if n % i == 0:
        ans = min(ans, max(dig(i), dig(n//i)))
    i += 1

print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict

n = int(input())
fact = defaultdict(int)
fact[1] = 1
f = 2
k = n
while f * f <= min(k * k, n):
    if k % f == 0:
        fact[f] += 1
        k //= f
    else:
        f += 1
if k > 1:
    fact[k] += 1


def digits(n):
    ret = 0
    while n > 0:
        ret += 1
        n //= 10
    return ret


def dfs(index, mul, fact):
    if index >= len(fact):
        return max(digits(mul), digits(n // mul))
    k, v = fact[index]
    ret = 10
    for i in range(v + 1):
        ret = min(ret, dfs(index + 1, mul * pow(k, i), fact))
    return ret


print(dfs(0, 1, list(fact.items())))

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = []
i = 1
while(i*i<=n):
    if (n%int(i)==0):
      ans.append(int(i))
    i += 1
a = int(max(ans))
b = int(n/a)
print(len(list(str(max(a,b)))))

Submission status: Accepted

Solution code:
N=int(input())
S=[]
res=[]
for i in range(round(N**0.5)):
    if N%(i+1)==0:
        S.append([i+1,int(N/(i+1))])
for j in range(len(S)):
    res.append(len(str(S[j][1])))
print(min(res))

Submission status: Accepted

Solution code:
n = int(input())
tes = 0
div = int(n**0.5)

while tes == 0 and div > 0:
  if n % div != 0:
    div -= 1
  else:
    tes = 1

import math
print(int(math.log10(n / div)+1))

Submission status: Accepted

Solution code:
import math
N = int(input())
for i in range(int(math.sqrt(N)) + 1, 0, -1):
    q, m = divmod(N, i)
    if m == 0:
        print(len(str(q)))
        break

Submission status: Accepted

Solution code:
from math import sqrt, ceil

n = int(input())
ans = 10**10+1

for i in range(1, ceil(sqrt(n))+1):
    d, m = divmod(n, i)
    if m == 0:
        left = len(str(i))
        right = len(str(d))
        f = max(left, right)
        if f <= ans:
            ans = f
print(ans)

Submission status: Accepted

Solution code:
#abc 057 c
import math
n=int(input())

def keta(x):
    cnt=0
    while int(x)>0:
        x/=10
        cnt+=1
    return cnt
limit_a=int(math.sqrt(n))
ans=n
for a in range(1,limit_a+1):
    if n%a==0:
        b=int(n/a)
        f=max(keta(a),keta(b))
    if ans>f:
        ans=f
print(ans)

Submission status: Accepted

Solution code:

f = lambda x, y: len(str(max(x, y)))

if __name__ == '__main__':
    n = int(input())
    a = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            a.append((i, n // i))
            if i != n // i:
                a.append((n//i, n // (n // i)))
    k = [f(e[0], e[1]) for e in a]
    print(min(set(k)))

Submission status: Accepted

Solution code:
def f(a, b):
    digit_a = digit_b = 0

    while a:
        digit_a += 1
        a //= 10

    while b:
        digit_b += 1
        b //= 10

    return max(digit_a, digit_b)


n = int(input())

ans = n

for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
        ans = min(ans, f(i, n // i))

print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
f = 0
ans = N
for i in range(1,int(math.sqrt(N))+2):
    if(N % i == 0 ):
        f = max(len(str(N//i)),len(str(i)))
        ans= min(ans,f)
        
print(ans)

Submission status: Accepted

Solution code:
def get_digit(n : int) -> int:
    count = 0
    while n != 0:
        count += 1
        n //= 10
    return count

N = int(input())

i = 1
candidate = 0
while i * i <= N:
    if N % i == 0:
        candidate = N // i
    i += 1

#print(candidate)
print(get_digit(candidate))

Submission status: Accepted

Solution code:
import math
N=int(input())
a=0
for i in range(1,1+math.ceil(math.sqrt(N))):
    if N%i==0 and i>a:
        a=i
b=int(N/a)
print(max([len(str(a)),len(str(b))]))

Submission status: Accepted

Solution code:
N = int(input())

#print(int((N**0.5)//1))
for i in range(min(int((N**0.5)//1)+1, 10**5), 0, -1):
    if N % i == 0:
        #print(i)
        print(max(len(str(i)), len(str(N//i))))
        exit()

Submission status: Accepted

Solution code:
n = int(input())

def count_digit(num):
    return len(str(num))

ln = count_digit(n)
i = 1
while ((i*i) <= n):
    if n % i == 0:
        b = int(n // i)
        cur = max(count_digit(i), count_digit(b))
        if ln > cur:
            ln = cur
    i+=1

print(ln)

Submission status: Accepted

Solution code:
n = int(input())
m = int(n ** (1 / 2))
for i in range(m, 0, -1):
    if n % i == 0:
        print(max(len(str(i)), len(str(n // i))))
        break

Submission status: Accepted

Solution code:
N = int(input())

import math

def f(A,B):
    return max(len(str(A)),len(str(B)))

ans = 100
for A in range(1,int(math.sqrt(N+1))+1):
    if N % A == 0:
        B = N // A
        ans = min(ans,f(A,B))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = 15
for i in range(1, int(n**0.5) + 1):
    if n% i == 0:
        a = min(a, max(len(str(i)), len(str(n//i))))
print(a)