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:
import math
n = int(input())

root = math.sqrt(n)
x = str(int(root // 1))
answer = 0

for i in reversed(range(1, int(x) + 1)):
    if n % i == 0:
        answer = i
        break
answer_2 = int(n / answer)

if len(str(answer)) >= len(str(answer_2)):
    print(len(str(answer)))
else:
    print(len(str(answer_2)))

Submission status: Accepted

Solution code:
n=int(input())
f=100
for i in range(1,int(n**0.5+1)):
  if n%i==0:
    ff=(max(len(str(n//i)),len(str(i))))
    if ff<f:
      f=ff
print(f)

Submission status: Accepted

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

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

def main():
	ans=15
	n=II()

	nn=int(n**0.5)+10

	for i in range(1,nn):
		if n%i==0:
			a=len(str(i))
			b=len(str(n//i))
			ans=min(ans,max(a,b))
			#print(a,b)

	print(ans)




if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def main():
    N = in_n()
    yaku = make_divisors(N)
    keta = lambda s: len(str(s))

    ans = 11
    for t in yaku:
        ans = min(ans, max(keta(t), keta(N // t)))

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())

ans_list=[]
a_max=int(n**(1/2))+1
for a in range(1,a_max):
    if n%a==0:
        
        b=n//a
        num_a=len(list(str(a)))
        num_b=len(list(str(b)))
        
        ans_list.append(max(num_a,num_b))
    
print(min(ans_list))

Submission status: Accepted

Solution code:
N = int(input())
ans = len(str(10**10))
for a in range(1, int(N**0.5)+1):
    d, r = divmod(N, a)
    if r==0:
        l = max([len(str(n)) for n in [d, a]])
        ans = min(ans, l)
print(ans)

Submission status: Accepted

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


N = int(input())

ans = 10**11
for i in range(1,int(N**0.5)+1):
    if N%i == 0:
        B = N//i
        
        tmp = max(calc_digits(i),calc_digits(B))
        
        ans = min(ans,tmp)

print(ans)

Submission status: Accepted

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

n = int(input())

a = math.ceil(math.sqrt(n))

ans = sys.maxsize

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

print(int(math.log10(ans) + 1))

Submission status: Accepted

Solution code:
import math
N = int(input())
min_= 100
for i in range(1,math.ceil(math.sqrt(N))+1,1):
    if (N % i != 0):
        continue
    a = i;
    b = int(N/a)
    min_ =min(min_,max(len(str(a)),len(str(b))))
print(min_)

Submission status: Accepted

Solution code:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

N = int(input())

div = make_divisors(N)
ans = 100

for d in div:
    a = d
    b = N // a
    ans = min(ans, max(len(str(a)), len(str(b))))
print(ans)

Submission status: Accepted

Solution code:
import sys
import math
n=int(input())
ans=100000000
N=int(math.sqrt(n))
for a in range(1,N+1):
    b=n//a
    if n==a*b:
        aa=str(a)
        bb=str(b)
        tmp=max(len(aa),len(bb))
        ans=min(ans,tmp)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
min = 10000000000000000000000000000000000000000000
M = int((N)**(1/2))
for i in range(1,M+1):
  if N%i==0:
    A = i
    B = N//i
    FAB  = max(len(str(A)),len(str(B)))
    if FAB < min:
      min = FAB
print(min)

Submission status: Accepted

Solution code:
import math


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


def main():
    N = int(input())
    A = factorization(N)

    C = []
    for a, n in A:
        for i in range(n):
            C.append(math.log10(a))

    C = sorted(C, reverse=True)
    t = sum(C) / 2

    p = 0
    q = 0
    for c in C:
        pp = p + c
        qq = q + c

        tp = abs(t - pp) + abs(t - q)
        tq = abs(t - p) + abs(t - qq)

        if tp < tq:
            p = pp
        else:
            q = qq

    p = int(p) + 1
    q = int(q) + 1

    print(max(p, q))


main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    div = []
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            div.append(n//i)
    
    f = div[-1]
    ans = 0
    while f > 0:
        f//=10
        ans+=1
    print(ans)
main()

Submission status: Accepted

Solution code:
n = int(input())
ans = len(str(n))

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:
# coding: utf-8
# Your code here!

def F(n, m):
  return max(len(str(n)), len(str(m)))

n = int(input())
ans = len(str(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:
N = int(input())
ans = len(str(N))
for i in range(1,int(N**0.5)+1):
    if N % i == 0:
        #print(i)
        #print("leng",len(str(N/i)))
        #print(ans,len(str(i)),len(str(N//i)),len(str(int(N/i))))
        ans = min(ans,max(len(str(i)),len(str(N//i))))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = len(str(n))
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:
import math

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

N = int(input())
minimum = len(str(N))

for i in range(1,int(math.sqrt(N))+1):
  if N % i == 0:
    j = int(N/i)
    minimum = min(F(i,j), minimum)
#print(i)
#print(j)
print(minimum)

Submission status: Accepted

Solution code:
n = int(input())
i = 1
ans = n
lst = []
while i * i <= n:
    if n % i == 0:
        ans = n // i
    i += 1

print(len(str(ans)))

Submission status: Accepted

Solution code:
N = int(input())
root_N = int(N**0.5)

for i in range(root_N, 0, -1):
    if N % i == 0:
        k = N//i
        print(len(str(k)))
        break

Submission status: Accepted

Solution code:
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
n = int(input())
div = prime_factorize(n)

ans = 11
m = len(div)
for i in range(1<<m):
    a, b = 1, 1
    for j in range(m):
        if i & (1<<j):
            a *= div[j]
        else:
            b *= div[j]
    tmp = max(a, b)
    ans = min(ans, len(str(tmp)))
print(ans)

Submission status: Accepted

Solution code:
def f(a, b):
    str_a = str(a)
    len_a = len(str_a)
    str_b = str(b)
    len_b = len(str_b)

    return len_a if len_a > len_b else len_b

N = int(input())

min = 10**10
max_iter = 10 ** (len(str(N))//2 + 1)

for i in range(1, max_iter):
    a = i
    if N % a == 0:
        b = int(N / a)
    else:
        continue

    ret = f(a, b)
    if min > ret:
        min = ret
        if min <= len(str(N))//2:
            break

print(min)

Submission status: Accepted

Solution code:
N = int(input())
import math
c = []
for i in range(1,math.floor(N**0.5)+1):
  if N % i == 0:
    c.append([i,int(N/i)])
cc = []
for j in c:
  r = max(len(str(j[0])),len(str(j[1])))
  cc.append(r)
print(min(cc))

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,len(str(N//i)))
print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())
sq = int(N ** 0.5)
for i in range(sq,0,-1):
    if N % i == 0:
        A = i
        B = N//i
        break
print(int(math.log10(B))+1)

Submission status: Accepted

Solution code:
import math
N = int(input())
m = int(math.sqrt(N)) + 1
mi = 1000000000
for i in range(1, m):
    if N % i == 0:
        mi = min(mi, int(math.log10(N/i)+1))
print(mi)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import math

n = int(input())

for a in range(math.ceil(math.sqrt(n)), 0, -1):
    if n % a == 0:
        break

b = int(n / a)
ans = math.floor(math.log10(b)) + 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
def LI():return map(int,input().split())
def I(): return input().split()

n=int(input())
lst=[]
ans=float("inf")
for i in range(1,int(n**0.5)+1):
    if n % i==0:
        lst.append((i,n//i))
# print(lst)
for j,k in lst:
    ans=min(ans,max(len(str(j)),len(str(k))))
print(ans)

Submission status: Accepted

Solution code:
import itertools

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

n = int(input())

f = factorization(n)

#print(f)

if len(f) == 1 and f[0][1] == 1:
    print(len(str(n)))
else:
    pf = []
    for r in f:
        if r[0] == 1:
            continue
        pf += [r[0]]*r[1]
    ans = len(str(n))
    for i in range(1,len(pf)//2+1):
        for c in itertools.combinations(pf, i):
            #print(c)
            tmp = 1
            for t in c:
                tmp *= t
            ans = min(ans, max(len(str(tmp)), len(str(n//tmp))))
    print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())
ans = len(str(N))

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

print(ans)

Submission status: Accepted

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

i=1
mn=len(str(n))
while i*i<=n:
    if n%i==0:
        b=n//i
        mn=min(mn,max(len(str(i)),len(str(b))))
    i+=1
print(mn)

Submission status: Accepted

Solution code:
n = int(input())

sqrt = 0

while sqrt*sqrt < n:
    sqrt += 1

for i in range(sqrt, 0, -1):
    if n%i == 0:
        print(len(str(n//i)))
        break

Submission status: Accepted

Solution code:
n = int(input())

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

sosu = make_divisors(n)
#print(type(sosu))
kumi = []
for i in range(len(sosu)):
  for j in range(len(sosu)):
    #print(type(sosu[i]))
    if sosu[i]*sosu[j] == n:
      kumi.append([str(sosu[i]), str(sosu[j])])
#print(kumi)
top = 10000000000
#iter = 0
#if 
for i in kumi[:int(len(kumi)/2)+2]:
  sums = max(len(i[0]), len(i[1]))
  if top > sums:
    top = sums
    #iter = max(len(kumi[0]), len(kumi[1]))
print(top)

Submission status: Accepted

Solution code:
s = input()
N = int(s)

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

Submission status: Accepted

Solution code:
import math
N = int(input())
max_num = 0
for v in range(1,int(math.sqrt(N))+1):
    if N % v == 0:
        max_num = max(max_num,v)
n = N // max_num

c_n = max(max_num,n)

res = 0

while 0 < c_n:
    c_n //= 10
    res += 1
print(res)

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)
    return divisors

def F(A,B):
    N=len(str(A))
    M=len(str(B))
    if N>=M:
        return N
    else:
        return M

N=int(input())
divisors=make_divisors(N)
ans=float("inf")
for A in divisors:
    B=N//A
    ans=min(ans,F(A,B))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

yaku = []

for i in range(1, N+1):
    if N % i == 0:
        if i in yaku:
            break
        if N/i <= i:
            yaku.append(i)
            break
        yaku.append(i)
        yaku.append(N//i)
    elif N/i < i:
        break

yaku.sort()
ans = str(yaku[len(yaku)//2])
print(len(ans))

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    import math
    N = int(input())
    sqrt_n = math.sqrt(N)

    B1=10**10
    for i in range(1, int(sqrt_n)+1):
        if N % i == 0:
            B1 = min(B1, N//i)
            
    B2 = N // B1
    print(max(len(str(B1)), len(str(B2))))


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
for i in range(int(n ** 0.5),-1,-1):
    if (n / i).is_integer():
        print(len(str(int(n / i))))
        exit()

Submission status: Accepted

Solution code:
n = int(input())

ans = 11
for a in range(1, int(n**0.5)+1):
    if n%a != 0:
        continue
    b = n//a
    ans = min(ans, max(len(str(a)), len(str(b))))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
factors = []
while n%2 == 0:
    factors.append(2)
    n //=2

for f in range(3, int(n**0.5)+ 1, 2):
    while n%f == 0:
        factors.append(f)
        n //= f
if n != 1:
    factors.append(n)

nf = len(factors)

fab = 11
sset = set()
als = 2**nf
for i in range(als):
    if als^i in sset:
        continue
    sset.add(i)
    a = 1
    b = 1
    for j in range(nf):
        if (i>>j)&1:
            a *= factors[j]
        else:
            b *= factors[j]

    fab = min(fab, max(len(str(a)), len(str(b))))
print(fab)

Submission status: Accepted

Solution code:
import math
n = int(input())
m = math.ceil(math.sqrt(n))
Q = 10

for i in range(1,m+1):
    if n%i == 0:
        p = int(n/i)
        if Q > len(str(p)):
            Q = len(str(p))
print(Q)

Submission status: Accepted

Solution code:
# ABC057_C
N = int(input())

lst = []
for i in range(1,int(N**0.5)+1):
    if N % i == 0:
        lst.append(max(len(str(int(N/i))),len(str(i))))

print(min(lst))

Submission status: Accepted

Solution code:
N=int(input())

ans=100000000
now=0

for i in range(1,int(N**0.5) +2):
    if N%i !=0:
        continue
    else:
        A=i
        B=int(N/A)
        now =max(len(str(A)),len(str(B)))
        ans =min(ans,now)
    
print(ans)

Submission status: Accepted

Solution code:
import sys
N = int(input())
if N == 1:
    print(1)
    sys.exit()

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

L = make_divisors(N)
l = len(L)
if l % 2 == 0:
    a1 = str(L[l // 2] - 1)
    a2 = str(L[l // 2])
    print(max(len(a1), len(a2)))
else:
    a1 = str(L[l // 2 - 1])
    a2 = str(L[l // 2])
    a3 = str(L[l // 2 + 1])
    d1 = max(len(a1), len(a2))
    d2 = max(len(a2), len(a3))
    print(min(d1, d2))

Submission status: Accepted

Solution code:
N=int(input())

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

ans=make_divisors(N)

def keta(n):
    for a in range(11):
        if 10**a<=n<10**(a+1):
            return a+1
F=[]
for num in ans:
    a=keta(num)
    b=keta(N//num)
    f=max(a,b)
    F.append(f)

print(min(F))

Submission status: Accepted

Solution code:

def calc_digit(n):
    tmp = str(n)

    return len(tmp)

n = int(input())

a = 1
ans = calc_digit(n)

while a**2 <= n:
    if n%a == 0:
        b = n//a

        cur = max(calc_digit(a),calc_digit(b))

        if ans > cur:
            ans = cur

    a += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())


def digit(N):
    return len(str(N))


f = []
i = 1
while i * i <= N:
    if N % i == 0:
        d1 = digit(i)
        d2 = digit(int(N/i))
        f.append(max(d1, d2))
    i += 1

print(min(f))

Submission status: Accepted

Solution code:
N = int(input())


def digit(N):
    d = 0
    while N >= 1:
        N /= 10
        d += 1
    return d


f = []
i = 1
while i * i <= N:
    if N % i == 0:
        d1 = digit(i)
        d2 = digit(int(N/i))
        f.append(max(d1, d2))
    i += 1

print(min(f))

Submission status: Accepted

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


def digit(N):
    d = 0
    while N >= 1:
        N /= 10
        d += 1
    return d


f = []
for i in range(1, int(math.sqrt(N))+1):
    if N % i == 0:
        d1 = digit(i)
        d2 = digit(int(N/i))
        f.append(max(d1, d2))

print(min(f))

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def 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(readline())
    divs = divisors(n)
    ans = INF

    for a in divs:
        b = n // a
        score = max(len(str(a)), len(str(b)))
        ans = min(ans, score)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
ans = float("inf")
a = 1
b = 1

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

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

Submission status: Accepted

Solution code:
import sys
import math

# python3にlongの概念はない
N = int(input())
M = int(math.sqrt(N))
# N**0.5でも可能
number = 1
ans = 1

for i in range(1, M+1):
    if N % i == 0:
        number = i

number = math.floor(N/number)
ans = len(str(number))

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def make_divisors(n): #約数列挙の関数を一部改変
    if n == 1:
        return 1
    lower_divisors , upper_divisors = [], [] 
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return n // lower_divisors[-1]

N = int(readline())
ans = make_divisors(N)
print(len(str(ans)))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# モジュールのインポート
import math


def get_input() -> int:
    """
    標準入力を取得する.

    Returns:\n
        int: 標準入力
    """
    N = int(input())
    return N


def F(A: int, B: int) -> int:
    """
    10進表記における、Aの桁数とBの桁数のうち大きい方を返す.

    Args:\n
        A (int): 整数
        B (int): 整数

    Returns:\n
        int: 10進表記における、Aの桁数とBの桁数のうち大きい方
    """
    digits_A = len(str(A))
    digits_B = len(str(B))
    return max(digits_A, digits_B)


def main(N: int) -> None:
    """
    メイン処理.

    Args:\n
        N (int): 整数（1 <= N <= 10^10）
    """
    # 求解処理
    # 全探索を行い、F(A, B)の最小値を求める
    # a <= bとして、sqrt(N)まで探索を行うことで、時間を節約する
    ans = len(str(N))  # 初期値として、Nの桁数を入力
    for a in range(1, int(math.sqrt(N)) + 1):
        # bが整数でない場合、何もしない
        if N % a != 0:
            continue

        # bが整数である場合、a, bのうち桁数が大きい方を求める
        b = int(N / a)
        ans = min(ans, F(a, b))

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    N = get_input()

    # メイン処理
    main(N)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# モジュールのインポート
import math

# 標準入力を取得
N = int(input())

def F(A: int, B: int) -> int:
    return max(len(str(A)), len(str(B)))

# 求解処理
ans = len(str(N))
for a in range(1, int(math.sqrt(N)) + 1):
    if N % a != 0:
        continue
    b = int(N / a)
    ans = min(ans, F(a, b))
    
# 結果出力
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = int(math.log10(N))
for n in range(1, int(math.sqrt(N))+1):
    if N % n == 0:
        ans = int(math.log10(N // n)) + 1
print(ans)

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    ret = MAX
    for n in range(1, int(math.sqrt(N)) + 1):
        if N % n == 0:
            b = N // n
            r = f(n, b)
            ret = min(r, ret)
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
p=make_divisors(N)
ans=10**9
for i in range(len(p)):
  ans=min(max(len(str(N//p[i])),len(str(p[i]))),ans)
print(ans)

Submission status: Accepted

Solution code:
def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


n = int(input())
li = make_divisors(n)
li = [(x, n // x) for x in li]

ans = 1 << 60
for x, y in li:
    ans = min(ans, max(len(str(x)), len(str(y))))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def divisor(n):
  i = 1
  table = []
  while i * i <= n:
    if n % i == 0:
      table.append(i)
      table.append(n//i)
    i += 1
  table = list(set(table))
  return table

n = int(input())
#print(divisor(n))
ans = []
for j in divisor(n):
  a = j
  b = int(n/a)
  #print(a,b)
  ans.append(max(len(str(a)), len(str(b))))
  #print(min(ans))
print(min(ans))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-06-26 16:16:00 +0900
# LastModified: 2020-06-26 19:11:55 +0900
#


import os
import sys
from math import sqrt
# import numpy as np
# import pandas as pd


def F(a, b):
    if len(str(a)) > len(str(b)):
        print(len(str(a)))
    else:
        print(len(str(b)))


def main():
    n = int(input())
    for i in range(int(sqrt(n)+1), -1, -1):
        if n % i == 0:
            a = i
            b = n//i
#            print(a,b)
            F(a, b)
            break


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
N=int(input())
frac=[]
for i in range(1,math.floor(math.sqrt(N))+1):
  if N%i==0:
    frac.append(len(str(int(N/i))))
if N !=1:
  print(min(frac))
else:
  print(1)

Submission status: Accepted

Solution code:
def main():
    N = int(input())

    def enum_divisors(n):
        ans = 10**12
        for i in range(1, n+1):
            if i*i > n:
                break
            if n % i == 0:
                v1 = str(i)
                v2 = str(n//i)
                ans = min(ans, max(len(v1), len(v2)))
        return ans

    print(enum_divisors(N))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
end = int(n**(0.5))+1
ans = len(str(n))

def F(a, b):
    return max(len(str(a)), len(str(b)))
    
for i in range(1, end):
    if n % i == 0:
        ans = min(ans, F(n//i, i))
print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
output = n
for index in range(int(math.sqrt(n)), 0, -1):
    if n % index == 0:
        output = n // index
        break
print(len(str(output)))

Submission status: Accepted

Solution code:
N = int(input())
ANS = 10**10 + 2
i = 1
while i * i <= N:
    if (N % i == 0):
        # print(i,' : ', int(N / i))
        max_len = max(len(str(i)),len(str(int(N / i))))
        ANS = min(ANS, max_len)

    i += 1

print(ANS)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())

def digit(n):
    l = 0
    while n:
        l += 1
        n //= 10
    return l

ans = 100
i = 1
while i ** 2 <= n:
    if n % i == 0:
        #ans = min(ans, max(len(str(i)), len(str(n // i))))
        ans = min(ans, max(digit(i), digit(n // i)))
    i += 1
print(ans)

Submission status: Accepted

Solution code:
from math import floor

def main():
    n = int(input())
    nsq = floor(n ** 0.5)
    r = 11
    for nsqe in range(nsq, 0, -1):
        if n % nsqe == 0:
            rt = max(len(str(nsqe)), len(str(n // nsqe)))
            r = min(r, rt)
    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

for i in range(int(pow(N, 1/2)), 0, -1):
  if N%i == 0:
    print(max(len(str(i)), len(str((N//i)))))
    break

Submission status: Accepted

Solution code:
from math import sqrt
n=int(input())
sn=int(sqrt(n)//1)

for i in range(sn,0,-1):
    if n%i==0:
        s=n//i
        break
    
print(len(str(s)))

Submission status: Accepted

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

def II(): return int(input())
def MII(): return map(int, input().split())
def LII(): return list(map(int, input().split()))

def main():
    N = II()

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

    print(mn)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from math import sqrt
N = int(input())
ans = 10000

for i in range(1,int(sqrt(N))+10):
    if N%i == 0:
        m = max(len(str(i)),len(str(N//i)))
        if m < ans:
            ans = m
print(ans)

Submission status: Accepted

Solution code:
N=int(input())

for i in range(1,N+1):
    if(N%i==0):
        j=int(N/i)
        ans=max(len(str(i)),len(str(j)))

    if(N<i**2):
        break
print(ans)

Submission status: Accepted

Solution code:
def dv(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
N=int(input())
L=dv(N)
if L==[1]:
  L=[1,1]
ans=10**10
for l in L:
  ans=min(ans,len(str(max(l,N//l))))
print(ans)

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)

    divisors.sort()
    return divisors
div_arr = make_divisors(N)

if len(div_arr) == 1:
    print(1)
elif len(div_arr) == 2:
    ans_num = max(div_arr)
    print(len(str(ans_num)))
else:
    memo = []
    if len(div_arr) % 2 == 0:
        last_idx = -1
        count = 0
        for i in range(len(div_arr)):
            count += 1
            if N == div_arr[i] * div_arr[last_idx] and count != len(div_arr) // 2:
                last_idx -= 1
                memo.append(len(str(div_arr[last_idx])))
            else:
                break
    else:
        target_index = len(div_arr) // 2
        memo.append(len(str(div_arr[target_index])))
    print(min(memo))

Submission status: Accepted

Solution code:
import math

N = int(input())

i = int(math.sqrt(N))
m = N % i

while m != 0:
    i -= 1
    m = N % i

A = int(math.log10(i))
B = int(math.log10(N//i))

res = max(A,B) + 1

print(res)