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 heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


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


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


def S(): return input()


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


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


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


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


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


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


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


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


show_flg = True
show_flg = False


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


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


def main():
    N = I()
    ans = 10**9

    for i in divisor(N):
        ans = min(ans, f(N // i, i))

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
N = int(input())
n = math.ceil(math.sqrt(N))
A = 1
B = N
for i in range(n+1):
  A = n-i
  if N%A==0:
    B = N//A
    break

print(len(str(B)))

Submission status: Accepted

Solution code:
import math
n=int(input())
s=int(math.sqrt(n))
ans=10**10

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

Submission status: Accepted

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

def f(x,y):
    return len(str(max(x,y)))
ans=len(str(n))
for i in range(2,int(math.sqrt(n))+1):
    if (n%i==0) and (ans>f(i,n//i)):
        ans=f(i,n//i)
print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
limit = int(math.sqrt(n))

ketamin = 11
for i in range(1,limit+1):
  if n%i == 0:
    sho=n//i
    if ketamin > len(str(sho)):
      ketamin = len(str(sho))
      
print(ketamin)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc057/tasks/abc057_c
n = int(input())

factors = []

i = 1
while i <= n ** 0.5:
    if n % i == 0:
        factors.append(i)
    i += 1

def func(a, b):
    A = len(str(a))
    B = len(str(b))
    return max(A, B)

ans = float('inf')
for f in factors:
    a, b = f, n // f
    t = func(a, b)
    ans = min(ans, t)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

n = int(N ** (1/2))
#arr =[]
res = check(1, N)

i = 1
while i <= n:
  if N % i == 0:
    res = min(res, check(i,int(N / i)))
  i += 1

print(res)

Submission status: Accepted

Solution code:
import math
n = int(input())
nn = math.floor(n ** (1/2))
for i in range(1,nn+1):
    f = n / i
    if f.is_integer():
        a = n // i
print(len(str(a)))

Submission status: Accepted

Solution code:
import math
n = int(input())
s = int(math.sqrt(n))

ans = 10**11

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

Submission status: Accepted

Solution code:
n = int(input())

for i in range(int(n**(0.5)),0,-1):
    if n%i == 0:
        ans1 = len(list(str(i)))
        ans2 = len(list(str(n//i)))
        print(max(ans1,ans2))
        break

Submission status: Accepted

Solution code:
N = int(input())
ans = 1
for i in range(1,int(N**0.5)+1):
    if N%i == 0:
        ans = max(ans,i)
print(len(str(int(N/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)
n = int(input())
ans = make_divisors(n)
if len(ans)%2 == 1:
    answer = ans[((len(ans)+1)//2)-1]
else:
    answer = ans[(len(ans)//2)]
print(len(str(answer)))

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())
for i in reversed(range(int(n**0.5)+1)):
    if n%i==0:
        print(max(len(str(i)), len(str(n//i))))
        exit()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def enum_divisors(n):
    res = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            res.append(i)
            res.append(n//i)
    return res
def f(a, b):
    return max(len(str(a)), len(str(b)))
def main():
    N = int(input())
    divisors = enum_divisors(N)
    ans = 10**8
    for i in range(len(divisors)-1):
        ans = min(ans, f(divisors[i], divisors[i+1]))
    print(ans)
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n = int(input())

def f(x,y):
    return len(str(max(x,y)))

sum = len(str(n))
#print(sum)
for i in range(2,int(math.sqrt(n))+1):
    if (n % i == 0) and (sum > f(i,n // i)):
        sum = f(i,n//i)
        #print(sum, i, n//i)
print(sum)

Submission status: Accepted

Solution code:
import math
N = int(input())
n = int(math.sqrt(N))

minFAB = len(str(N))

for i in range(1,n+1):
    l = len(str(i))
    m = len(str(N//i))
    if N%i == 0:
        minFAB = min(minFAB,max(l,m))

print(minFAB)

Submission status: Accepted

Solution code:
n=int(input())
n2=int(n**0.5)+1

nmin=n
for i in range(1,n2+1):
    if n%i==0:
        nmin=min(nmin,max(i,n//i))
#        print(i,n//i,nmin)

print(len(str(nmin)))

Submission status: Accepted

Solution code:

def resolve():
    def n_len(a, b):
        a = str(a)
        b = str(b)
        res = max(len(a), len(b))
        return res

    N = int(input())

    ans = 10**9+1
    i = 1
    while i*i <= N:
        if N%i == 0:
            a = i
            b = N//i
            ans = min(ans, n_len(a, b))
        i += 1
    print(ans)

if __name__ == "__main__":
    resolve()

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())
r = make_divisors(N)
res = []
for i in r:
    y = N // i
    res.append(max(len(str(y)), len(str(i))))
print(min(res))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import numpy as np
 
N = int(input())
ans = len(str(N))
for i in range(2, int(np.sqrt(N)) + 2):
    if not N % i:
        a = max(len(str(i)), len(str(int(N / i))))
        ans = min(ans, a)
print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
root_n = int(math.sqrt(n))


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


l = []
for i in range(2, root_n + 1):
    if n % i == 0:
        a = int(n / i)
        l.append(max(digit(a), digit(i)))
if l:
    print(min(l))
else:
    print(digit(n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
n = int(N**(1/2))

for i in reversed(range(n)):
  if N % (i+1) == 0:
    print(len(str(int(N / (i+1)))))
    exit()

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = float('Inf')
sq = int(math.sqrt(N)) + 1
for i in range(1, sq):
    if N % i == 0:
        a = len(str(i))
        b = len(str(N // i))
        if a > b:
            num = a
        else:
            num = b
        if ans > num:
            ans = num
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
import math
ans = float('Inf')
sq = int(math.sqrt(n)) + 1
for i in range(1, sq):
    #print(i, n // i)
    if n % i != 0:
        continue
    #print(i, n // i)
    ans = min(ans, max(len(str(i)), len(str(n // i))))
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
import sys
import math

N = int(input())

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

minimum = float('inf')

for a in range(1, int(math.sqrt(N))+1):
    if N % a == 0:
        minimum = min(minimum, f(a, N // a))

print(minimum)

Submission status: Accepted

Solution code:
N = int(input())
M = int(N ** 0.5)
for i in range(M, 0, -1):
    if N % i == 0:
        A = i
        B = N // i
        break
ans = max(len(str(A)), len(str(B)))
print(ans)

Submission status: Accepted

Solution code:
import sys,os
from collections import defaultdict, deque
from math import ceil, floor
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    N = II()

    for i in range(int(N**0.5),0,-1):
        if N % i == 0:
            print(max(len(str(N//i)),len(str(i))))
            return

    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

# 桁数の多い方の数字の桁数を返す関数
def f(a, b):
    a_digits = len(list(str(a)))
    b_digits = len(list(str(b)))
    return max([a_digits, b_digits])

f_min = 10**10
for a in [i for i in range(1, int(N**0.5)+1) if N % i == 0]:
    b = int(N / a)
    if f(a, b) < f_min:
        f_min = f(a, b)

print(f_min)

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    mind = float('inf')
    i = 1
    ans = []
    while i * i <= n:
        if n%i == 0:
            if i == n//i:
                ans.append(i)
                mind = min(mind,len(str(i)))
            else:
                ans.append(i)
                ans.append(n//i)
                maxd = max(len(str(i)),len(str(n//i)))
                mind = min(mind,maxd)
        i += 1
    print(mind)
if __name__ == '__main__':
  main()

Submission status: Accepted

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

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

n = int(input())

divisors = make_divisors(n)

l = len(divisors)
#print(divisors)

ans = float('inf')
for i in range(l):
    a = divisors[i]
    b = int(n/a)
    m = max([a,b])
    keta = 1
    while m > 9:
        m = int(m/10)
        keta += 1
    ans = min([ans, keta])

print(ans)

Submission status: Accepted

Solution code:
N = int(input()) 
# 約数取って全探索で良い？
def f(a,b):
    x = max(a,b)
    cnt = 1
    while x//10 > 0:
        x //= 10
        cnt += 1
    return cnt

# 約数
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

divs = make_divisors(N)
ans = 10**10
for div in divs:
    if div > N/div:
        continue
    else:
        ans = min(ans, f(div,N//div))
print(ans)

Submission status: Accepted

Solution code:
import math  # noqa
import bisect  # noqa
import queue  # noqa


if __name__ == '__main__':
    N = int(input())

    # 桁数の差をなるべく小さくする
    # = ルート
    ans = 10000000005
    M = math.ceil(math.sqrt(N))
    for i in range(1, M + 1):
        if N % i == 0:
            ans = min(ans, len(str(N // i)))
    print(ans)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
N = int(input())
import math
n = math.sqrt(N)
n = int(n)+1
c = N
for i in range(1,n):
    if N % i == 0:
        c = int(N/i)

s = str(c)
print(len(s))

Submission status: Accepted

Solution code:
import math

N = int(input())
n = int(math.sqrt(N))

def f_ab(a, b):
    if len(str(a)) >= len(str(b)):
        return len(str(a))
    else:
        return len(str(b))

ans = float('inf')
for a in range(1, n+1):
    if N % a == 0:
        b = N // a
        ans = min(ans, f_ab(a, b))
print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    
    ans = 20
    for i in range(1, int(N ** 0.5) + 1):
        if N % i == 0:
            a = str(i)
            b = str(N // i)
            ans = min(ans, max(len(a), len(b)))
    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
# solution
import math
import io
# libraries

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

Submission status: Accepted

Solution code:
N = int(input())

min = float('inf')

for i in range(1, int(N**0.5)+1, 1):
    if N%i==0:
        A = i
        B = N//i
        keta = max(len(str(A)), len(str(B)))
        if keta<min:
            min = keta

print(keta)

Submission status: Accepted

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

d = 1
ans = 15
while(d ** 2 <= N):
    if(N % d == 0):
        A = d
        B = N / d
        ans = min(ans,max(math.floor(math.log10(A))+1,math.floor(math.log10(B)) + 1) )
        #print([ans,A,B])

    d += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
M = int(N**0.5)
l = []
if N <= 3:
  print(1)
else:
  for a in range(1, M+1):
    if N % a == 0:
      b = int(N/a)
    else:
      continue
    l.append(max(len(str(a)), len(str(b))))
  print(min(l))

Submission status: Accepted

Solution code:
n = int(input())
def f(x,y):
    x = str(x)
    y = str(y)
    return max(len(x),len(y))
i = 1
nums = []
while i*i <=n:
    if n%i == 0:
        nums.append(i)
    i +=1
ans= 10**100
for num in nums:
    ans = min(ans,f(num,n//num))
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
#n,p=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:
        mn=min(mn,
        max(len(str(n//i)),len(str(i))))
    i+=1
print(mn)

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)
            divisors.append(n//i)

    # divisors.sort()
    return divisors

def F(a, b):
    list_A = list(str(a))
    list_B = list(str(b))
    num = max(len(list_A), len(list_B))

    return num

n = int(input())
list_N = make_divisors(n)
h = len(list_N)
list_ANS = []

for i in range(0, h, 2):
    list_ANS.append(F(list_N[i], list_N[i+1]))

print(min(list_ANS))

Submission status: Accepted

Solution code:
N = int(input())

k = 0

for i in range(1,int(N**(0.5))+1):
    if N % i == 0:
        n = str(int(N // i))
        I = str(i)
        K = len(n) if len(n) >= len(I) else len(I)
        if k == 0:
            k = K
        else:
            if k > K:
                k = K
            else:
                continue

print(k)

Submission status: Accepted

Solution code:
n = int(input())

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

ans = 11
for key in divisors:
  a, b = str(key[0]), str(key[1])
  ans = min([ans, max([len(a), len(b)])])

print(ans)

Submission status: Accepted

Solution code:
def I(): return int(input())
N = I()
ans = float('INF')
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        ans = min(len(str(N//i)),ans)
print(ans)

Submission status: Accepted

Solution code:
def I(): return int(input())
N = I()
ans = float('INF')
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        temp = max(len(str(i)),len(str(N//i)))
        ans = min(temp,ans)
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 = min(F, len(str(N // (i+1)))) 
print(F)

Submission status: Accepted

Solution code:
n = int(input())
ans = 100
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 f(A,B):
	return len(str(max(A,B)))
n=int(input())
a=[]
for i in range(1,int(n**0.5)+1):
	if n%i==0:
		a.append(f(i,n//i))
print(min(a))

Submission status: Accepted

Solution code:
n = int(input())
if n == 1:
	print (1)
	exit()
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
a = make_divisors(n)
a.sort()
c = 100
for i in a:
	if i > n//2:
		break
	j = n//i
	c = min(max(len(str(i)),len(str(j))),c)
print(c)

Submission status: Accepted

Solution code:
"""
掛け算は順序を入れ替えてもいいので、
√n + 1くらいまで探索
"""
import math
n = int(input())
r = []
def F(a,b):
    return max(len(str(a)),len(str(b)))
for i in range(1,int(math.sqrt(n))+1):
    if n%i == 0:
        r.append(F(i,n//i))
print(min(r))

Submission status: Accepted

Solution code:
import math
N = int(input())
for i in range(1,math.ceil(N**(1/2))+1)[::-1]:
    if N%i == 0:
        print(max(len(str(i)),len(str(N//i))))
        break

Submission status: Accepted

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

Submission status: Accepted

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


def Calc_Divisors(num):
    divisors = []
    for i in range(1, int(sqrt(num)) + 1):
        if num % i == 0:
            divisors.append(i)
            if i != num // i:
                divisors.append(num//i)
    divisors.sort()
    return divisors


if __name__ == "__main__":
    n = int(input())

    div = Calc_Divisors(n)

    ans = len(str(n))
    for d in div:
        tmp = max([len(str(d)), len(str(n//d))])
        if tmp < ans:
            ans = tmp

    print(ans)

Submission status: Accepted

Solution code:
num = int(input())
import math
min = 1000000000000000
limit = math.floor((num ** 0.5) + 1)
for i in range(1, limit):
  if num % i == 0:
    j = num / i
    lsti = []
    lstj = []
    while i > 0:
      lsti.append(i%10)
      i //= 10
    while j > 0:
      lstj.append(j%10)
      j //= 10
    lengthi = len(lsti)
    lengthj = len(lstj)
    if max(lengthi, lengthj) < min:
      min = max(lengthi, lengthj)
print(min)

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:
        j = n // i
        ans = min(ans, len(str(j)))

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 10 ** 5
for i in range(1, 10**5+1):
    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 = len(str(n))
for i in range(2, int(n**0.5) + 1):
    if n % i == 0:
        b = int(n / i)
        f = max(len(str(i)), len(str(b)))
        if ans > f or ans == 0:
            ans = f
print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())
m = 10

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

print(m)

Submission status: Accepted

Solution code:
N = int(input())

num_list = []

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

ans = 10**9+7

for i in range(len(num_list)):
    tmp = max(len(str(num_list[i][0])),len(str(num_list[i][1])))
    ans = min(ans,tmp)
    
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
n = N
fac = Counter()
while n % 2 == 0:
    n >>= 1
    fac[2] += 1
p = 3
while p*p <= n:
    while n % p == 0:
        n /= p
        fac[p] += 1
    if n == 1:
        break
    p += 2

fac_list = list(fac.items())

def ndigit(x):
    n = 0
    while x > 0:
        n += 1
        x //= 10
    return n

ND = ndigit(N)

def solve(fi, acc):
    if fi == len(fac_list):
        #import pdb; pdb.set_trace()
        assert N % acc == 0
        other = N // acc
        return max(ndigit(acc), ndigit(other))

    p, max_cnt = fac_list[fi]
    minval = ND
    m = 1
    for i in range(max_cnt+1):
        minval = min(minval, solve(fi+1, acc*m))
        m *= p
    return minval

print(solve(0, 1))

Submission status: Accepted

Solution code:
import math
N = int(input())
if math.sqrt(N)%1 == 0:
    K = int(math.sqrt(N))
    print(len(str(K)))
else:
    ls1 = []
    for i in range(1,math.ceil(math.sqrt(N))+1):
        if N%i == 0:
            ls1.append(i)
    K = max(ls1)
    A = str(N//K)
    B = str(K)
    print(max(len(A),len(B)))

Submission status: Accepted

Solution code:
n = int(input())
ans = 10**10
for i in range(1, int(n**0.5)+1):
    if n % i != 0:
        continue
    else:
        b = n // i
        ans = min(ans, max(len(str(i)), len(str(b))))
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, int(n / i)))
            if i != n // i:
                divisors.append((i, int(n // i)))
    return divisors

divisors = make_divisors(N)
length = 1e10
for d in divisors:
    if length > len(list(str(max(list(d))))):
        length = len(list(str(max(list(d)))))

print(length)

Submission status: Accepted

Solution code:
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MAKEDIVS = lambda n: [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]

def main():
    n = II()
    divisors = MAKEDIVS(n)
    ans = len(str(divisors[-1][1]))
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
def make_divisors(n):
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]

def main():
    n = II()
    divisors = make_divisors(n)
    ans = len(str(divisors[-1][1]))
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
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 main():
    n = II()
    divisors = make_divisors(n)
    minp = (10**10, 0)
    for a,b in divisors:
        if abs(minp[0]-minp[1]) > abs(a-b):
            minp = (a,b)
    A = len(str(minp[0]))
    B = len(str(minp[1]))
    print(max(A,B))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

n = int(sys.stdin.readline().rstrip())

def main():
    res = divisors(n)
    print(len(str(n // res[-1])))

if __name__ ==  '__main__':
    main()

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):
    return max(len(list(map(int, str(A)))), len(list(map(int, str(B)))))

N = int(input())
divs = make_divisors(N)
ans = 10**10
for A in divs:
    B = N//A
    ans = min(ans, F(A, B))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

cd = divisor(N)
ans = len(str(cd[-1]))
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
r = []

for i in range(1,math.floor(N**0.5)+1):
  if N%i == 0:
    r.append(i)
    
print(len(str(N//r[-1])))

Submission status: Accepted

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
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

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# ここから書き始める
N = int(input())
ans = INF
for A in range(1, int(sqrt(N)) + 1):
    if N % A != 0:
        continue
    B = N // A
    A_length = len(str(A))
    B_length = len(str(B))
    ans = min(ans, max(A_length, B_length))
print(ans)

Submission status: Accepted

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

res = N
for A in range(1, int(math.sqrt(N)) + 1):
    if N % A == 0:
        B = N // A
        res = min(res, max(len(str(A)), len(str(B))))
print(res)

Submission status: Accepted

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