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


# print(make_divisors(N))
d = make_divisors(N)

ans = 10 ** 18

for i in d:
    p = N // i
    keta = max(len(str(i)), len(str(p)))
    ans = min(ans, keta)

print(ans)

Submission status: Accepted

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

N = int(input())
divisors = make_divisors(N)
ans = 12
for i in range(0, len(divisors), 2):
    a, b = divisors[i], divisors[i+1]
    m, n = 0, 0
    for x in range(1, 12):
        if a < 10 ** x:
            m = x
            break
    for x in range(1, 12):
        if b < 10 ** x:
            n = x
            break
    ans = min(ans, max(m, n))
print(ans)

Submission status: Accepted

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


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


for a in make_divisors(n):
    b = int(n / a)
    if len(str(a)) <= len(str(b)):
        ans.append(len(str(b)))

print(min(ans))

Submission status: Accepted

Solution code:
import math

n = int(input())
m = len(str(n))

for a in range(1,int(math.sqrt(n))+1):
    if (n // a) * a == n:
        if m > len(str(max(a,(n//a)))): 
            m = len(str(max(a,(n//a))))
            
print(m)

Submission status: Accepted

Solution code:
n = int(input())
def make_div(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

ans=10**11
for num in make_div(n):
    f = max(len(str(num)), len(str(n//num)))
    if ans > f:
        ans=f
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ret = float("inf")
for A in range(1,100000):
  if N % A == 0:
    ret = min(ret,max(len(str(A)),len(str(N//A))))
print(ret)

Submission status: Accepted

Solution code:
N = int(input())
ret = float("inf")
for A in range(1,100000):
  if N % A == 0:
    ret = min(ret,max(len(str(A)),len(str(N//A))))
print(ret)

Submission status: Accepted

Solution code:
def prime(n):
  if n <= 1:
    return False
  for i in range(2, int(n**0.5)+1):
    if n % i == 0:
      return False
  return True
def digit(n):
  return len(str(n))
def F(a, b):
  return max(digit(a), digit(b))
r = N = int(input())
breakpoint = 0
if prime(N):
  print(digit(N))
else:
  for i in range(1, N+1):
    if i == breakpoint or i > N**0.5:
      break
    if N % i == 0:
      r = min(r, F(i, int(N/i)))
      breakpoint = i
  print(r)

Submission status: Accepted

Solution code:
n = int(input())
a = 1
ans = n
while a * a <=n:
    if n%a == 0:
        b = n//a
        ans = min(ans, b)
    a += 1
print(len(str(ans)))

Submission status: Accepted

Solution code:
n = int(input())
t = int(n**(1/2))+1
for i in range(t):
    a = t-i
    if n%a == 0:
        b = int(n/a)
        print(len(str(b)))
        break

Submission status: Accepted

Solution code:
n = int(input())

target_range = int(n**0.5+0.5)

min_value = 10
for x in range(1,target_range+1):
    if n%x == 0:
        result = max([len(str(x)),len(str(n//x))])
        #pdb.set_trace()
        
        if min_value > result:
            min_value = result
            
print(min_value)

Submission status: Accepted

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


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


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

N = int(input())

max_A = math.floor(N**0.5)
#print(max_A)
ans = len(str(N))
#print("initial answer : ", ans)
for A in range(1, max_A+1):
  if N % A == 0:
    B = int(N / A)
    if len(str(B)) >= len(str(A)) and len(str(B)) < ans:
      ans = len(str(B))
      #print(A,B,ans)
    elif len(str(A)) > len(str(B)) and len(str(A)) < ans:
      ans = len(str(A))
      #print(A,B,ans)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#057_C
n=int(input())
def f(a,b):
    return max(len(str(a)),len(str(b)))
for i in range(1,int(n**.5)+1):
    if n%i==0:
        ans=f(i,n//i)
print(ans)

Submission status: Accepted

Solution code:
from math import sqrt
N = int(input())
v = int(sqrt(N)) + 1
ans = 100
for i in range(v, 0, -1):
    if N % i == 0:
        s1 = str(i)
        s2 = str(N // i)
        # print('s1 s2', s1, s2)
        new_ans = max(len(s1), len(s2))
        ans = min(new_ans, ans)
print(ans)

Submission status: Accepted

Solution code:
from math import sqrt
N = int(input())
v = int(sqrt(N)) + 1
for i in range(v, 0, -1):
    if N % i == 0:
        s1 = str(i)
        s2 = str(N // i)
        # print('s1 s2', s1, s2)
        ans = max(len(s1), len(s2))
        print(ans)
        exit()

Submission status: Accepted

Solution code:
# atcoder
import math

def get_number_of_digits(n):
    return int(math.log10(n) + 1)

def get_larger_digits(a, b):
    return max(get_number_of_digits(a), get_number_of_digits(b))

n = int(input())
min_digit = float('inf')
for a in range(1, int(math.sqrt(float(n))+5.0)):
    if n % a != 0:
        continue
    b = int(n / a)
    if n == a * b:
        temp_digit = get_larger_digits(a, b)
        min_digit = min(min_digit, temp_digit)
print(min_digit)

Submission status: Accepted

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


def make_divisors(n):
    ans = float('inf')
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            ans = min(ans, f(i, n // i))
    return ans


n = int(input())
print(make_divisors(n))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

F = 1
F_min = 10**10

for A in range(1,int((N+1)**(1/2))+1):
  if N%A == 0:
    F = max(len(str(A)),len(str(int(N/A))))
    if F_min > F:
      F_min = F
            
print(F_min)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)

import math

import logging

logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger(__name__)

from collections import defaultdict
d = defaultdict(list)

import operator
from functools import reduce


def prod(iterable):
    return reduce(operator.mul, iterable, 1)


# from itertools import combinations
# comb = combinations(range(N), 2)

# 累積和
# from itertools import accumulate
# _list = list(accumulate(a_list)

# from functools import lru_cache
# @lru_cache(maxsize=None)
# def setUp(self):
#     dp.cache_clear()


def dividers(n: int):
    for i in range(1, math.ceil(math.sqrt(n)) + 1):
        if n % i == 0:
            yield i


def prime_factor(n: int):
    res = defaultdict(int)
    res[1] = 1
    for i in range(2, math.ceil(math.sqrt(n))):
        while (n % i == 0):
            res[i] += 1
            n = n // i

    if (n != 1):
        res[n] = 1

    return res


def flatten_key_count(d):
    return sum([[k for _ in range(d[k])] for k in d.keys()], [])


def resolve():
    # S = [x for x in sys.stdin.readline().split()][0]  # 文字列 一つ
    N = [int(x) for x in sys.stdin.readline().split()][0]  # int 一つ
    # N, D = [int(x) for x in sys.stdin.readline().split()]  # 複数int
    # h_list = [int(x) for x in sys.stdin.readline().split()]  # 複数int

    # grid = [list(sys.stdin.readline().split()[0]) for _ in range(N)]  # 文字列grid
    # v_list = [int(sys.stdin.readline().split()[0]) for _ in range(N)]
    # grid = [[int(x) for x in sys.stdin.readline().split()]
    #         for _ in range(N)]  # int grid

    logger.debug('{}'.format([]))

    if N == 1:
        print(1)
        return

    _min = 10**10
    for a in dividers(N):
        b = N // a

        if a > b:
            _min = min(_min, len(str(a)))
        else:
            _min = min(_min, len(str(b)))

    print(_min)


if __name__ == "__main__":
    resolve()

# AtCoder Unit Test で自動生成できる, 最後のunittest.main は消す
# python -m unittest template/template.py で実行できる
# pypy3 -m unittest template/template.py で実行できる

import sys
from io import StringIO
import unittest


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)

Submission status: Accepted

Solution code:
import math

n = int(input())

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

min = 10

for i in range(1,int(math.sqrt(n))+1):
    if n%i==0 and min > f(i,n//i):
        min = f(i,n//i)

if n<10:
    min=1

print(min)

Submission status: Accepted

Solution code:
# coding: utf-8

n = int(input().rstrip())

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
import sys

import numpy as np
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
"""dd = [(-1, 0), (0, 1), (1, 0), (0, -1)];
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)];
ddn9 = ddn + [(0, 0)]
for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""

def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]  # WideIntPoint
def ws(): return sys.stdin.readline().split()
def si(): return int(sys.stdin.readline())  # SingleInt
def ss(): return input()
def hi(n): return [si() for _ in range(n)]
def hs(n): return [ss() for _ in range(n)]  # HeightString
def s_list(): return list(input())
def mi(n): return [wi() for _ in range(n)]  # MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]  # NumberGrid
def grid(n): return [s_list() for _ in range(n)]


def main():
    n = int(input())
    root_n = np.sqrt(n)
    root_n = int(root_n)
    ans = 10**10
    for i in range(1,root_n+1):
        if n % i == 0:
            b = n // i
            str_b = str(b)
            ans = min(ans, len(str_b))
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc057/tasks/abc057_c
# なるべく√Nに近い約数を2つ探し、それにF(A,B)を適応すればよい


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


N = int(input())
from math import sqrt

ans = 11
for i in range(1, int(sqrt(N)) + 1):
    if N % i == 0:
        ans = min(ans, F(N // i, i))
print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
ans = 10

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

Submission status: Accepted

Solution code:
import math

N = int(input())
A = 1
L = len(str(N))
while A <= math.sqrt(N):
    if N % A == 0:
        k = max( len(str(A)), len(str(int(N/A))) )
        if k < L:
            L = k
    A +=1
print(L)

Submission status: Accepted

Solution code:
n=int(input())
mi = 10**10
for p in range(1,int(n**0.5)+1):
    if n%p==0:
        q = n//p
        digit = max(len(str(p)), len(str(q)))
        if mi > digit: mi=digit
print(mi)

Submission status: Accepted

Solution code:
def divisors(n):
    res=int(10e+14)
    for i in range(1,int(n**0.5)+1):
        if(n%i==0):
            tmp=max(len(str(i)),len(str(n//i)))
            res=min(res,tmp)
    return res

N=int(input())
print(divisors(N))

Submission status: Accepted

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

min_value = -1
limit = math.floor(math.sqrt(N))
for n in range(1, limit+1):
  if (N % n != 0):
    continue
  else:
    A = n
    B = N // n
    len_A = len(str(A))
    len_B = len(str(B))
    F = len_A if (len_A > len_B) else len_B
    if (min_value == -1):
      min_value = F
    else:
      if (min_value > F):
        min_value = F

print(min_value)

Submission status: Accepted

Solution code:
import math


def f(x, y):
    return max(int(math.log10(x) + 1), int(math.log10(y) + 1))


count = 10 ** 10
N = int(input())

for i in range(1, int(math.sqrt(N)) + 1):
    if N % i == 0:
        tmp = f(i, N // i)
        if tmp <= count:
            count = tmp
print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

fmin = 1000000000
for a in range(1, int(N ** 0.5) + 1):
    b = N // a
    if a * b == N:
        fmin = min(fmin, F(a, b))
print(fmin)

Submission status: Accepted

Solution code:
n = int(input())

def myfunc(a, b):
    len_a = len(str(a))
    len_b = len(str(b))
    return max(len_a, len_b)

n_sqrt = n ** 0.5
i = 1
MIN = n
while i <= n_sqrt:
    if n % i == 0:
        MIN = min(MIN, myfunc(i, n // i))
    i += 1
print(MIN)

Submission status: Accepted

Solution code:
n = int(input())

def f(a: int, b:int) -> int:
    return max(len(list(str(a))), len(list(str(b))))

ans = float("inf")
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:
from math import sqrt


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


def main():
    n = int(input())
    min_f = 10
    for a in range(int(sqrt(n))+1, 0, -1):
        if n % a == 0:
            b = n // a
            min_f = min(min_f, f(a, b))
    print(min_f)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from math import sqrt

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


def main():
    n = int(input())
    min_f = 10
    for a in range(1, int(sqrt(n))+1):
        if n % a == 0:
            b = n // a
            min_f = min(min_f, f(a, b))
    print(min_f)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
ans=10**100
for i in range(1,int(n**0.5)+1):
    if n%i==0:
        b=n//i
        tmp=max(len(str(i)),len(str(b)))
        ans=min(tmp,ans)
print(ans)

Submission status: Accepted

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

    divisors.sort()
    return divisors

from math import log10
N = int(input())
div = make_divisors(N)

def F(A, B):
    return max(int(log10(A))+1, int(log10(B))+1)
ans = 10**9
for a, b in div:
    ans = min(ans, F(a, b))
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

    divisors.sort()
    return divisors

from math import log10
N = int(input())
div = make_divisors(N)

def F(A, B):
    return max(log10(A)+1, log10(B)+1)
ans = 10**9
for a, b in div:
    ans = min(ans, F(a, b))
print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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


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


ans = 10**4
for i in range(1, int(w)+2):
    if n % i != 0:
        continue
    j = n//i
    ans = min(f(i, j), ans)
print(ans)

Submission status: Accepted

Solution code:
def main():
    num = int(input())
    i = 2
    answer = len(str(num))
    while i * i <= num:
        if not num % i:
            answer = max(len(str(i)), len(str(num // i)))
        i += 1
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def bunkai(num):
    a = []
    while num % 2 == 0:
        a.append(2)
        num //= 2
    f = 3
    while f * f <= num:
        if num % f == 0:
            a.append(f)
            num //= f
        else:
            f += 2
    a.append(num)
    if len(a) == 1:
        a.append(1)
    return a
def kake(klist):
    dst = 1
    for i in klist:
        dst *= i
    return dst
src = int(input())
kumi = bunkai(src)
kumiawase = []
for i in range(1, len(kumi)):
    for k in range(len(kumi) - i + 1):
        nums = kake(kumi[k:k + i])
        if nums not in kumiawase:
            kumiawase.append(nums)
dsti = []
for i in range(len(kumiawase)):
    dsti.append((src//kumiawase[i], kumiawase[i]))
fx = lambda x, y: len(str(x)) if len(str(x)) > len(str(y)) else len(str(y))
dst = min([fx(*i) for i in dsti])
print(dst)

Submission status: Accepted

Solution code:
#python3
from math import floor
from math import sqrt
def g(x):
    cnt = 0
    if x == 0:
        return 1
    while x:
        x //= 10
        cnt += 1
    return cnt

def F(x, y):
    return max(g(x), g(y))

def main():
    n = int(input())
    ans = 100
    for a in range(1, floor(sqrt(n))+1):
        if n%a == 0:
            b = n//a
            ans = min(ans, F(a, b))
    print(ans)
main()

Submission status: Accepted

Solution code:
n=int(input())
hanbun=int(n**(1/2))+1
for i in range(hanbun,-1,-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:
n = int(input())
min_f = 10
for i in range(1, n + 1):
    if i ** 2 > n:
        break
    if n % i != 0:
        continue
    min_seq = max(len(str(i)), len(str(n // i)))
    if min_seq < min_f:
        min_f = min_seq
print(min_f)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

    # divisors.sort()
    return divisors
print(min(make_divisors(N)))

Submission status: Accepted

Solution code:
import math

n = int(input())

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

ans = n
lim = math.floor(math.sqrt(n))

for i in range(1, lim + 1):
    if n % i == 0:
        temp = f(i, n // i)
        if temp < ans:
            ans = temp
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import math
n = int(input())
ans = 10

def fun(a,b):
    if len(str(a)) <= len(str(b)):
        return(len(str(b)))
    else:
        return(len(str(a)))

#print(fun(125,80))

b =int(math.sqrt(n+1) // 1) + 1
#print(b)

for i in range(1,b):
    if n % i == 0:
#        print(i,int(n/i))
        if ans > fun(i,int(n/i)):
            ans = fun(i,int(n/i))
#            print(ans)

print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
res = float("inf")
for i in range(1, int(math.sqrt(n))+1):
    if n % i == 0 and res > max(len(str(int(n/i))), len(str(i))):
        res = max(len(str(int(n/i))), len(str(i)))

print(res)

Submission status: Accepted

Solution code:
from itertools import combinations
from functools import reduce
from operator import mul
def prime_dec(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(n)
  return table

n = int(input())
ps = prime_dec(n)
ps = [1] if len(ps) == 0 else ps
ps_com = []
for i in range(len(ps)):    
    ps_com += set(combinations(ps, i+1))
divs = [reduce(mul, k) for k in ps_com if not len(k) == 0]
divs_twin = [(k, int(n/k)) for k in divs]
divs_twin = set(divs_twin)
divs_twin_len = [max(len(str(k[0])) ,len(str(k[1])))  for k in divs_twin]

print(min(divs_twin_len))

Submission status: Accepted

Solution code:
def args():
    return int(input())


def F(a, b):
    return len(str(b)) if len(str(a)) < len(str(b)) else len(str(a))


def solve(N):
    import math

    res = len(str(N))
    for a in range(1, int(math.ceil(math.sqrt(N))) + 1):
        if N % a == 0:
            b = N // a
            res = min(res, F(a, b))

    return res


if __name__ == '__main__':
    n = args()
    ans = solve(n)
    print(ans)

Submission status: Accepted

Solution code:
def func(A,B):
  cntA=1
  while A//10:
    A//=10
    cntA+=1
  cntB=1
  while B//10:
    B//=10
    cntB+=1
  return max(cntA,cntB)
ans=10000000001
N=int(input())
NN=int((N+1)**0.5)
for i in range(1,NN+1):
  if N%i==0:
    j=N//i
    tmp=func(i,j)
  ans=min(ans,tmp)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

    divisors.sort()
    return divisors

n = int(input())
div1 = make_divisors(n)
div2 = [0] * len(div1)
for i in range(len(div1)):
    div2[i] = n // div1[i]

pair = [0] * len(div1)
for i in range(len(div1)):
    pair[i] = (div1[i], div2[i])

ans = 100000
for i in pair:
    ans = min(ans, max(len(str(i[0])), len(str(i[1]))))
print(ans)

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:
        x=len(str(i))
        y=len(str(n//i))
        z=max(x,y)
    if ans > z:
        ans=z
print(ans)

Submission status: Accepted

Solution code:
n=int(input())


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

Submission status: Accepted

Solution code:
import sys
import math
input = sys.stdin.readline
 
N = int(input())
a = int(math.sqrt(N))
 
A = 0
B = 0
for i in reversed(range(1, a + 1)):
  if not N % i:
    A = i
    B = N // A
    break
 
print(max(len(str(A)), len(str(B))))

Submission status: Accepted

Solution code:
N = int(input())

def digit10(X, Y) :
    dig_X = 0
    dig_Y = 0
    while X :
        dig_X += 1
        X //= 10
    while Y :
        dig_Y += 1
        Y //= 10
    return max(dig_X, dig_Y)

root_N = int(N ** 0.5)
ans = 100

for A in range(1,root_N+1) :
    if N%A == 0 :
        B = N // A
        ans = digit10(A, B)

print(ans)

Submission status: Accepted

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


def solve(N: int):
    result = len(str(N))
    for A in range(1, int(N ** 0.5) + 1):

        if N % A == 0:
            B = N // A
            f_value = max(len(str(A)), len(str(B)))
            result = min(result, f_value)

    print(result)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    min_len = 0
    if float.is_integer(N ** 0.5):
        print(len(str(int(N ** 0.5))))
        return
    A = int(N ** 0.5) + 1
    for a in range(A, 0, -1):
        if N % a == 0:
            print(len(str(N // a)))
            break


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
N = int(input())
nsqrt = int(math.sqrt(N))
ans = 10**9
for i in range(1, nsqrt+1):
    if N % i == 0:
        stri = str(i)
        strdiv = str(N // i)
        ans = min(ans, max(len(stri), len(strdiv)))
print(ans)
# print(nsqrt)

Submission status: Accepted

Solution code:
def f(a,b):
    return max(len(str(a)),len(str(b)))
def solve():
    n = int(input())
    l = f(n,1)
    for i in range(1,int(n**.5)+1):
        if n%i==0:
            l_ = f(i,n//i)
            if l>l_:
                l=l_
    print(l)
solve()

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    N = int(input())
    f_vals = []
    for A in range(1, int(math.sqrt(N))+1):
        if N % A != 0:
            continue
        B = int(N / A)
        f_vals.append(max(len(str(A)), len(str(B))))
    print(min(f_vals))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math


def check(A,B):
    digit_list=[]
    for num in [A,B]:
        count=0
        tmp_num=num
        while tmp_num != 0:
            tmp_num //= 10
            count += 1
        
        digit_list += [count]
    
    return max(digit_list)

#----------
N = int(input().strip())
#----------
min_f=10
for i in range( 1, math.ceil( N**(1/2) ) + 1 ):
    if (N % i) == 0:
        A,B = i,(N / i)
        digit = check(A,B)
        
        if min_f > digit:
            min_f = digit

print(min_f)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n=int(input())
rootn=int(math.sqrt(n))
ketamin=12
for i in range(1,rootn+2):
    if n%i==0:
        fab=max(i,n//i)
        fabstr=str(fab)
        keta=len(fabstr)
        if ketamin>keta:
            ketamin=keta
print(ketamin)

Submission status: Accepted

Solution code:
N = int(input())
ans = 9999999999999
n = 1
while n*n <= N:
    if not N % n:
        ans = min(ans, max(len(str(N//n)), len(str(n))))
    n += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

M = int(N**(1/2))
min_ans = len(str(N))
ans = 0

for i in range(1,M+1):
    a, b = divmod(N, i)
    if b==0:
        ans = max(len(str(a)),len(str(i)))
        if min_ans >= ans:
            min_ans = ans

print(min_ans)