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:
def PrimeDecomp(N,ConcFlag):
    if ConcFlag:
        if N<=1:
            return [1],1
        else:
            I = 2
            PrimeDec = []
            DivCount = 1
            while I*I<=N:
                Cnt = 0
                while N%I==0:
                    N //= I
                    PrimeDec.append(I)
                if Cnt>=1:
                    DivCount *= (Cnt+1)
                I += 1
            if N>=2:
                PrimeDec.append(N)
                DivCount *= 2
            return PrimeDec,DivCount        
    else:
        if N<=1:
            return [1],[1],1
        else:
            I = 2
            PrimeDec = []
            PrimeCnt = []
            DivCount = 1
            while I*I<=N:
                Cnt = 0
                while N%I==0:
                    N //= I
                    Cnt += 1
                if Cnt>=1:
                    PrimeDec.append(I)
                    PrimeCnt.append(Cnt)
                    DivCount *= (Cnt+1)
                I += 1
            if N>=2:
                PrimeDec.append(N)
                PrimeCnt.append(1)
                DivCount *= 2
            return PrimeDec,PrimeCnt,DivCount
          
from itertools import combinations
from operator import mul
from functools import reduce
N = int(input())
PrimeDec,_ = PrimeDecomp(N,True)
FABMax = len(str(N))
for TR in range(1,len(PrimeDec)+1):
    for A in set(reduce(mul,T) for T in combinations(PrimeDec,TR)):
        B = N//A
        FABMax = min(FABMax,max(len(str(A)),len(str(B))))
print(FABMax)

Submission status: Accepted

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

s=1
for i in range(int(math.sqrt(n))+1):
    if n%(i+1)==0:
        s=len(str(int(n/(i+1))))
print(s)

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())
ans=100
for i in make_divisors(n):
  ans=min(ans,max(len(str(i)),len(str(n//i))))
print(ans)

Submission status: Accepted

Solution code:
N = int(input()) 
ans = 111111111110
for i in range(1,int(N**0.5+2)):
    if N%i == 0:
        use = N//i 
        s = str(use) 
        t = str(i) 
        ans = min(ans, max(len(s), len(t))) 

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

l = len(div)
flist = []
for i in range(l):
    fx = max([len(str(div[i][0])), len(str(div[i][1]))])
    flist.append(fx)

print(min(flist))

Submission status: Accepted

Solution code:
# @oj: atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-08-17 16:49
# @url:https://atcoder.jp/contests/abc057/tasks/abc057_c

import sys,os
from io import BytesIO, IOBase
import collections,itertools,bisect,heapq,math,string
from decimal import *
# region fastio

BUFSIZE = 8192

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# ------------------------------
def main():
    n=int(input())
    ans=20
    for i in range(1,math.ceil(math.sqrt(n))+1):
        if n%i==0:
            a,b=str(i),str(n//i)
            ans=min(ans,max(len(a),len(b)))
    print (ans)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def calc_digits(num):
    ans = 1
    while True:
        if num // 10 == 0:
            break
        num //= 10
        ans += 1

    return ans


def main():
    N = int(input())
    ans = 10 ** 10

    for A in range(1, int(N ** 0.5) + 1):
        if N % A != 0:
            continue
        B = N // A
        A_digits = calc_digits(A)
        B_digits = calc_digits(B)

        max_digits = max(A_digits, B_digits)
        if max_digits < ans:
            ans = max_digits

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
r_N = int(N ** (1 / 2))
 
li = []
for n in range(1,r_N + 1):
  if N % n == 0:
    a = N // n
    l = max(len(str(a)),len(str(n)))
    li.append(l)
    
print(min(li))

Submission status: Accepted

Solution code:
n=int(input())
l=[]
t=int(n**0.5)
while len(l)==0:
    if n%t==0:
        l.append((t,n//t))
    t-=1
x,y=l[0][0],l[0][1]
ans=max(len(list(str(x))),len(list(str(y))))
print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
max_target = int(math.sqrt(n) // 1)
ans = 10 ** 9
for a in range(1, max_target + 1):
  if n % a == 0:
    b = n // a
    f = max(len(str(a)), len(str(b)))
    ans = min(ans, f)
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
sqrt = math.floor(math.sqrt(N))
ans = 10
for A in range(1,sqrt+1):
    n = 0
    if N % A != 0:
        continue
    B = N / A
    while not B == 0:
        n += 1
        B //= 10
    ans = min(ans, n)
print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())

m = n

for i in range(1, math.floor(n ** 0.5) + 1):
    if n % i == 0:
        l = len(str(i))
        ll = len(str(n // i)) 
        if m > max(l, ll):
            m = max(l, ll)

print(m)

Submission status: Accepted

Solution code:
import math

def digit(n):
  return math.floor(math.log10(n)) + 1

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

minD = 0

for i in range(int(sqN) + 2):
  if i == 0:
    minD = digit(N)
  elif N % (i + 1) == 0:
    D = max([digit(i + 1), digit(N // (i + 1))])
    if minD > D:
      minD = D

print(minD)

Submission status: Accepted

Solution code:
import math
n = int(input())
max_target = int(math.sqrt(n) // 1)
ans = 10 ** 9
for a in range(1, max_target + 1):
  if n % a == 0:
    b = n // a
    f = max(len(str(a)), len(str(b)))
    ans = min(ans, f)
print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def main():
    N = int(input())
    n = int(N ** 0.5) + 1
    ans = 10**18
    for a in range(n, 0, -1):
        if N % a != 0: continue
        b = str(N // a)
        print(len(b))
        return

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

m = int(n**0.5)+1
while m:
  if n%m == 0:
    a = len(str(m))
    b = len(str(n//m))
    break
  else: m -= 1
print(max(a,b))

Submission status: Accepted

Solution code:
N = int(input())
F = 0
ans = 10 ** 10
i = 1
while i * i <= N:
  A = i
  if N % A == 0:
    B = N // A
    F = max(len(str(A)), len(str(B)))
    ans = min(ans, F)
  i += 1 
print(ans)

Submission status: Accepted

Solution code:
#
# abc057 c
#
import sys
from io import StringIO
import unittest
import math


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

    def test_入力例_1(self):
        input = """10000"""
        output = """3"""
        self.assertIO(input, output)

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

    def test_入力例_3(self):
        input = """9876543210"""
        output = """6"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    ans = float("inf")
    for a in range(1, int(math.sqrt(N))+1):
        if N % a == 0:
            b = N // a
            ans = min(ans, len(str(b)))
    print(ans)


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

Submission status: Accepted

Solution code:
n = int(input())
nn = int(n**(1/2))
while True:
    if n % nn == 0:
        break
    nn -= 1
print(len(str(n//nn)))

Submission status: Accepted

Solution code:
def calc_digits(num):
	ans = 1

	while True:
		if num // 10 == 0:
			break

		num //= 10
		ans += 1

	return ans


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

	n = int(N ** 0.5)
	ans = 10 ** 10

	for A in range(1, n + 1):
		if N % A == 0:
			B = int(N / A)
		else:
			continue

		A_digits = calc_digits(A)
		B_digits = calc_digits(B)

		max_digits = max(A_digits, B_digits)

		if max_digits < ans:
			ans = max_digits

	print(ans)



  
if __name__ == "__main__":
  	main()

Submission status: Accepted

Solution code:
import math

n=int(input())
for i in range(1,int(math.sqrt(n))+1):
    ans=0
    if n%i==0:
        j=int(n/i)
        ans1=str(i)
        ans2=str(j)
        if len(ans1)>=len(ans2):
            break

if len(ans1)>=len(ans2):
    print(len(ans1))
else:
    print(len(ans2))

Submission status: Accepted

Solution code:
import math
N = int(input())
n = int(math.sqrt(N))+1
for i in range(1, n):
  if N % i == 0:
    B = N // i
for i in range(10, -1, -1):
  if B >= 10**i:
    print(i+1)
    break

Submission status: Accepted

Solution code:
x = int(input())
ans = 10000
k = 1
while (k * k <= x):
    if (x%k == 0):
        j = max(len(str(int(x/k))), len(str(k)))
        ans = min(j, ans)
    k += 1
print(ans)

Submission status: Accepted

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

n = int(input())

i = 1
ans = 1000000000000
while i * i <= n:
    if (n % i == 0):
        a = i
        b = n//a
        a_keta = len(str(a))
        b_keta = len(str(b))
        m_keta = max(a_keta, b_keta)
        ans = min(ans, m_keta)
    i += 1
print(ans)

Submission status: Accepted

Solution code:
import math

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

N = int(input())
List = make_divisors(N)
len_a = len(List)
ans = List[ len_a // 2 ]
print( math.floor(math.log(ans , 10)) + 1 )

Submission status: Accepted

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

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())
l=make_divisors(n)
s=(len(l)+1)//2
a=len(str(l[:s][-1]))
b=len(str(l[::-1][:s][-1]))
print(max(a,b))

Submission status: Accepted

Solution code:
import math
n=int(input())
ans = 10**10
for a in range(1,int(math.sqrt(n))+1):
  if n%a:
    continue
  b = n//a
  ans = len(str(b))
print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
root_n = int(math.sqrt(n)) + 10
ans = 1<<60
def f(a, b):
    len_a = len(str(a))
    len_b = len(str(b))
    return max(len_a, len_b)
for i in range(1, root_n):
    if n % i == 0:
         ans = min(ans, f(i, n // i))
print(ans)

Submission status: Accepted

Solution code:
#abc057c
n = int(input())
list = []

for ni in range(1,n+1):
    if ni * ni <= n:
        if n % ni == 0:
            list.append(max(len(str(ni)),len(str(n//ni))))
    else:
        break
print(min(list))

Submission status: Accepted

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


n = int(input())
a = 1
b = n
res = float('inf')
while a * a <= n:
    if n % a == 0:
        b = n // a
        temp = max(get_digit(a), get_digit(b))
        if temp < res:
            res = temp
    a += 1
print(res)

Submission status: Accepted

Solution code:
N = int(input())
maxn = N
for i in range(1,int(N**(1/2))+1):
    # print(i)
    if N%i==0:
        maxn = min(maxn,len(str(N//i)))
        # print(i,N//i)

print(maxn)

Submission status: Accepted

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

minF = N
for i in range(1, int(math.sqrt(N))+1):
  if N%i!=0:
    pass
  else:
    f = max(i,int(N/i))
    if f < minF:
      minF = f

print(len(str(minF)))

Submission status: Accepted

Solution code:
def make_divisors(n):
    #https://qiita.com/LorseKudos/items/9eb560494862c8b4eb56
    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 f(a,b):
    str_a = str(a)
    str_b = str(b)
    return(max(len(str_a),len(str_b)))

n = int(input())
yakusu = make_divisors(n)
kazu = (len(yakusu)+1)//2
ans = 11
for j in range(kazu):
    ans = min(ans,f(yakusu[j],yakusu[-(j+1)]))

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
m = int(n**0.5)

while n%m:
    m -= 1

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

Submission status: Accepted

Solution code:
n = int(input())

l = []
for i in range(1, int(n**.5)+1):
    if n % i == 0:
        a = len(str(i))
        b = len(str(n // i))
        l.append((a,b))

max_list= []
for j in range(len(l)):
    max_list.append(max(l[j][0], l[j][1]))
print(min(max_list))

Submission status: Accepted

Solution code:
import math

n = int(input())
i = math.ceil(n ** 0.5)

while i > 0:
    if n % i == 0:
        print(len(str(n // i)))
        break
    i -= 1

Submission status: Accepted

Solution code:
#約数全部
def Divisors(N):
    N=abs(N)
    L,U=[],[]
    k=1
    while k*k <=N:
        if N%k== 0:
            L.append(k)
            if k!=N//k:
                U.append(N//k)
        k+=1
    return L+U[::-1]

def f(A,B):
    M=max(A,B)
    return len(str(M))
#================================================
N=int(input())
L=Divisors(N)
Y=float("inf")
for a in L:
    Y=min(Y,f(a,N//a))
print(Y)

Submission status: Accepted

Solution code:
n = int(input())

#約数取得
def make_divisors(n):
    divisors_keta = []
    i = 1
    while i*i <= n:
        if n % i == 0:
            divisors_keta.append(max(len(str(i)), len(str(n//i))))
            #print(i, n/i, len(str(i)), len(str(n//i)))
        i += 1
    return divisors_keta

keta_min_sort = sorted(make_divisors(n))

#print(keta_min_sort)
print(keta_min_sort[0])

Submission status: Accepted

Solution code:
import math

n = int(input())

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

results = []

# itr_end = int(n ** 0.5) + 1
itr_end = int(math.sqrt(n)) + 1

for i in range(1, itr_end):
    if n % i == 0:
        a = i
        b = n / i
    result = f(a, b)
    results.append(result)

print(min(results))

Submission status: Accepted

Solution code:
n = int(input())

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

results = []

for i in range(1, int(n ** (1/2)) + 1):
    if n % i == 0:
        a = i
        b = n / i
    result = f(a, b)
    results.append(result)

print(min(results))

Submission status: Accepted

Solution code:
n = int(input())

fab = 0

ans = 1000

n_s = int(n ** (1/2))

for i in range(1, n_s + 2):
    if n % i == 0:
        a = len(str(i))
        b = len(str(int(n / i)))
        #print(n/i, i, a, b)
        if a > b and a < ans:
            ans = a
        elif a < b and b < ans:
            ans = b
        elif a == b and a < ans:
            ans = a


print(ans)

Submission status: Accepted

Solution code:
def handan(a,b):
  return max(len(str(a)),len(str(b)))
def yakusu(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())
L=yakusu(N)
maxa=10**10
for i in range(len(L)):
  s=L[i]
  t=N//s
  maxa=min(maxa,handan(s,t))
print(maxa)

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
        tmp=len(str(max(i,j)))
        ans=min(ans,tmp)
print(ans)

Submission status: Accepted

Solution code:
N=int(input())

pairs=[]
for i in range(1,int(N**.5)+5):
  if N % i == 0:
    pairs.append((i,N//i))
    
def f(pair):
  return max(len(str(pair[0])),len(str(pair[1])))

print(min(map(f,pairs)))

Submission status: Accepted

Solution code:

import math
N=int(input())

def func(A,B):
  if A > B:
    return len(str(A))
  else:
    return len(str(B))


ans=[]
N2=math.floor(math.sqrt(N))
for A in range(1,N2+1):
  if N%A==0:
    B=int(N/A)
    ans.append(func(A,B))

print(min(ans))

Submission status: Accepted

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

import math
def main():
    N = int(input())

    ans = 10**10
    for i in range(1, int(math.sqrt(N)) + 1):
        j = N // i

        if i * j == N:
            ans = min(ans, f(i, j))

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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 factorize_list_format_change(fact_list_old):
    fact_list_new = []
    for prime_num in fact_list_old:
        for _ in range(prime_num[1]):
            fact_list_new.append(prime_num[0])
    return fact_list_new


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

def solve():
    N = int(input())
    fact_list_old = factorization(N)
    fact_list = factorize_list_format_change(fact_list_old)
    min_F = calc_degit(N)
    for i in range(1, 2**len(fact_list)):
        A = 1
        B = 1
        grouping_str = format(i, '0'+str(len(fact_list))+'b')
        for j in range(len(fact_list)):
            if grouping_str[j] == "0":
                A *= fact_list[j]
            else:
                B *= fact_list[j]
        min_F_temp = max(calc_degit(A), calc_degit(B))
        if(min_F_temp < min_F):
            min_F = min_F_temp
    print(min_F)


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
n=int(input())

for a in range(1,int(n**0.5+1)):
    if n%a==0:
        b=n//a
        sa=str(a)
        sb=str(b)
        if a<=b:
             ans=len(sb)
        else:
            break

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
F = 11

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

Submission status: Accepted

Solution code:
N = int(input())

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

res = 100

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

print(res)

Submission status: Accepted

Solution code:
n = int(input())
import math
ans = 100000000000
for i in range(int(math.sqrt(n))+1):
    if n%(i+1) == 0:
        ans = min(ans, max(len(str(n//(i+1))), len(str(i+1))))
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)))
    exit()

Submission status: Accepted

Solution code:
N = int(input())
mn=100
for A in range(1,int(N**(0.5))+1):
    cnta=0
    cntb=0
    if N%A==0:
        B=N/A
        while A>0:
            A//=10
            cnta+=1
        while B>0:
            B//=10
            cntb+=1
        cnt=max(cnta,cntb)
        mn=min(mn,cnt)
print(mn)

Submission status: Accepted

Solution code:
import math
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
num=factorization(n)
if len(num)==1:
    if num[0][1]==1:
        ans=num[0][0]
    else:
        ans=num[0][0]*(-(num[0][1]//-2))
    print(len(str(ans)))
else:
    num2=int(math.sqrt(n))
    if num[-1][0]>=num2:
        ans=num[-1][0]
    else:
        for i in range(num2):
            if n%(num2-i)==0:
                ans=n//(num2-i)
                break
    print(len(str(ans)))

Submission status: Accepted

Solution code:
N = int(input())

import math
for i in range(int(math.sqrt(N))+1,0,-1):
    if N%i == 0:
        num = N//i
        break
print(len(str(num)))

Submission status: Accepted

Solution code:
import math
N = int(input())
# N = A*Bに変形したいが、A,Bの組み合わせはいくつかあるはず。
# 50なら、(1,50)(2,25)(5,10)(10,5)(25,2)(50,1)
# 基本的に、順に並べた時に真ん中にあるやつが一番A,Bの間に桁数の差がない。なのでこれを使えば最小値は求められそう。
# 7*7 < 50 < 8*8 なので、検索範囲はsqrt(50)まで。
# そうすると、1<=  N <= 10**10 なので、検索範囲を10**5まで減らせる。あとは全部やればいい


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


ans = float('inf')
for a in range(1, int(math.sqrt(N)) + 1):
    if N % a != 0:
        continue
    b = int(N / a)
    a = str(a)
    b = str(b)
    # print(a, b)
    ans = min(ans, f(a, b))
print(ans)

Submission status: Accepted

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

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


def input_int():
    return int(input())


N = input_int()
ans = len(str(N))
for i in range(1, math.ceil(N ** 0.5) + 1):
    if (N / i).is_integer():
        ans = min(ans, max(len(str(i)), len(str(N // i))))
print(ans)

Submission status: Accepted

Solution code:
from math import *
N=int(input())
K=sqrt(N)
F=11
for a in range(1,int(K)+1):
  if N%a==0:
    b=N//a
    al=len(str(a))
    bl=len(str(b))
    G=max(al,bl)
    F=min(F,G)
print(F)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
c = 10
for i in reversed(range(1, int(-(-(n**0.5) // 1)) + 1)):
    if n % i < 1:
        c = min(c, max(len(str(n // i)), len(str(i))))
print(c)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[2]:


import math


# In[13]:


N = int(input())


# In[15]:


ans = len(str(N))
x = int(math.sqrt(N)//1)
a = 1
while a < x+1:
    if N%a == 0:
        b = N//a
        ans = min(ans,max(len(str(a)),len(str(b))))
    a += 1
print(ans)


# In[ ]:

Submission status: Accepted

Solution code:
import math
n = int(input())
a = 1
b = n

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

Submission status: Accepted

Solution code:
n = int(input())

start = int(n**0.5 + 1)
for a in range(start,0,-1):
    if n%a == 0:
        b = n//a
        print(len(str(b)))
        exit()

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

divisors.sort()
length=len(divisors)
if length == 2:
    A=str(divisors[0])
    B=str(divisors[1])
elif length%2 == 0:
    A=str(divisors[length//2-1])
    B=str(divisors[length//2])
else:
    A=str(divisors[length//2])
    B=str(divisors[length//2])

#print(A,B)

ans=max(len(A),len(B))
print(ans)

Submission status: Accepted

Solution code:
import math as m
n=int(input())
A=1
B=n
for i in range(1, int(m.sqrt(n))+1):
    if n % i == 0:
        A, B = i, n // i

print(int(m.log10(B))+1)

Submission status: Accepted

Solution code:
n = int(input())
score = 100
for i in range(1, 10**6):
    if n % i == 0:
        tmp_score = max(len(str(i)), len(str(n//i)))
        if score > tmp_score:
            score = tmp_score
print(score)

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 fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
mind = float('inf')
i = 1
while i*i <= n:
    if n%i == 0:
        if i == n//i:
            mind = min(mind, len(str(i)))
        else:
            maxd = max(len(str(i)), len(str(n//i)))
            mind = min(mind, maxd)
    i += 1
print(mind)

Submission status: Accepted

Solution code:
def F(x,y):
    x = str(x)
    y = str(y)
    return max(len(x),len(y))
N = int(input())
fmin = 100
for x in range(1,int(N**0.5)+1):
    if N%x==0:
        y = N//x
        fmin = min(fmin,F(x,y))
print(fmin)

Submission status: Accepted

Solution code:
n = int(input())
x = round(n**0.5)

while n%x!=0:
    x -= 1
y = n//x
print(len(str(max(x,y))))

Submission status: Accepted

Solution code:
N = int(input())
ds = set()
m = 1
while m*m <= N:
    if N%m==0:
        ds.add(m)
        ds.add(N//m)
    m += 1

ans = 999
for d in ds:
    e = N//d
    t = max(len(str(d)) ,len(str(e)))
    ans = min(ans, t)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def cal_divisors(N):
    divisors = []
    i = 1
    while i*i <= N:
        if N % i == 0:
            divisors.append(i)
        i += 1
    return divisors

divisors = cal_divisors(N)
ans = 10**12

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

Submission status: Accepted

Solution code:
N=int(input())
ans=1000000
import math
aa=math.sqrt(N)
aa=int(aa//1)
for A in range(1,aa+1):
    B=N/A
    if B%1.0==0.0:
        ta=len(str(A))
        tb=len(str(int(B)))
        if ta<tb:
            temp=tb
        else:
            temp=ta
        if ans>temp:
            ans=temp

print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
ans = math.inf
for i in range(1, int(n ** 0.5) + 1):
    if (n / i).is_integer():
        ans = min(ans, max(len(str(i)), len(str(int(n / i)))))
print(ans)

Submission status: Accepted

Solution code:
import math

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

n=int(input())
rt=int(math.sqrt(n))
min_ab=10**10
for a in range (1,rt+1):
  if n % a !=0:
    continue
  b=n//a
  f_ab=max(d_len(a),d_len(b))
  min_ab=min(min_ab,f_ab)
print(min_ab)

Submission status: Accepted

Solution code:
N=int(input())
if N==1:
    print(1)
    exit()
l=[]
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        l.append(i)
#print(l)
a=l[-1]
b=N//a
s=max(a,b)
print(len(str(s)))

Submission status: Accepted

Solution code:
N=int(input())
from math import*
count=round(sqrt(N))+1
while count:
    if N%count==0:
        A=len(str(count))
        B=len(str(N//count))
        break
    else:
        count-=1
print(max(A,B))

Submission status: Accepted

Solution code:
N = int(input())

for i in range(int(N ** 0.5), 0, -1):
    if N % i == 0:
        break

j = N // i
print(len(str(j)))

Submission status: Accepted

Solution code:
import math


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


def read_ints():
    return list(map(int, input().strip().split(' ')))


def digits(n):
    count = 1
    while n > 9:
        n //= 10
        count += 1
    return count


def solve():
    N = read_int()
    low, high = 0, 10**5+1
    while high-low > 1:
        mid = low+(high-low)//2
        if mid*mid > N:
            high = mid
        else:
            low = mid
    min_f = math.inf
    for i in range(1, low+1):
        if N%i == 0:
            min_f = min(min_f, max(digits(i), digits(N//i)))
    return min_f


if __name__ == '__main__':
    print(solve())

Submission status: Accepted

Solution code:
N=int(input())

def digit(x):
    digit=1
    while x>0:
        if x//10>0:
            digit+=1
            x//=10
        else:
            break
    return digit

for i in range(int(N**(1/2)),-1,-1):
    if N%i!=0:
        pass
    else:
        print(digit(N//i))
        break