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:

url = "https://atcoder.jp//contests/abc057/tasks/abc057_c"
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def main():
    n = int(input())
    ans = 10000000000000000
    ns = make_divisors(n)
    for i in range(0, (len(ns)//2) + 1):
        tmp = max(len(str(ns[i])), len(str(ns[len(ns)-i-1])))
        ans = tmp if tmp < ans else ans
    if len(ns) % 2 != 0:
            tmp = len(str(ns[len(ns) // 2]))
            ans = tmp if tmp < ans else ans
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

import string

def main():
    N = i_input()

    l = []
    for i in range(1,math.ceil(sqrt(N))+1):
        if N % i == 0:
            l.append(i)

    ans = INF
    for i in l:
        b = N//i
        c = max(i,b)
        ans = min(ans, len(str(c)))
    print(ans)


if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 057: C – Digits in Multiplication
N = int(input())

Fs = [len(str(N))]

for n in range(2, int(N ** (1 / 2)) + 1):
    if N % n == 0:
        num_digit = len(str(n)) if len(str(n)) >= len(str(N // n)) else len(str(N // n))
        Fs.append(num_digit)

print(min(Fs))

Submission status: Accepted

Solution code:
from math import sqrt

n = int(input())
ans = float("INF")
for i in range(1,int(sqrt(n))+1):
    if n%i == 0:
        j = n//i
        ans = min(ans,max(len(str(i)),len(str(j))))
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


x=int(input())
ans=float('inf')

for i in make_divisors(x):
  a,b=i,x//i
  a,b=str(a),str(b)

  ans=min(ans,max(len(a),len(b)))


print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import sqrt
n = int(input())
res = 100
for a in range(1, int(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:
import math


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

    # A < B として、探索する
    # A <= 10^5
    keta = int(math.log10(N))+1
    for A in range(1, int(pow(N, 0.5)) + 1):
        if N % A == 0:
            B = N // A
            # print(B, int(math.log10(B))+1)
            keta = min(keta, int(math.log10(B))+1)

    print(keta)


main()

Submission status: Accepted

Solution code:
n = int(input())
def f(a,b):
    a = list(str(a))
    b = list(str(b))
    return max(len(a),len(b))

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

Submission status: Accepted

Solution code:
n = int(input())
def f(a,b):
    a = list(str(a))
    b = list(str(b))
    return max(len(a),len(b))

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

l = make_divisors(n)
if len(l)%2 == 0:
    m = float('inf')
    for i in range(len(l)//2):
        m = min(m, f(l[i],n//l[i]))
    print(m)
else:
    m = float('inf')
    for i in range(len(l)//2+1):
        m = min(m, f(l[i],n//l[i]))
    print(m)

Submission status: Accepted

Solution code:
n=int(input())
sq=int(n**0.5)
while n%sq!=0:
  sq-=1
print(max(len(str(n//sq)),len(str(sq))))

Submission status: Accepted

Solution code:
n=int(input())

root=int(n**0.5)

min_keta=10000000000
for i in range(1,root+1):
    if n%i==0:
        one=len(str(i))
        two=len(str(n//i))
        min_keta=min(min_keta,max(one,two))




print(min_keta)

Submission status: Accepted

Solution code:
N = int(input())

ans = float("inf")
for a in range(1, N+1):
    if a * a > N: break
    if N % a ==0:
        b = N / a
        f = max(a, b)
        keta = 0
        while True:
            keta += 1
            if 10 ** keta > f:
                break
        ans = min(ans, keta)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# C - Digits in Multiplication
def main():
    n = int(input())
    ans = []

    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ans.append(max(len(str(i)), len(str(n//i))))
    else:
        print(min(ans))



        
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

# 与えられた数値の桁数と桁値の総和を計算する.
def calc_digit_sum(num):
    digits = sums = 0
    while num > 0:
        digits += 1
        sums += num % 10
        num //= 10
    return digits, sums


n = input()
answer = len(n)

num = int(n)
limit = int(math.sqrt(num)) + 1
for divide in range(1, limit):
    candidate = num // divide
    if candidate * divide == num:
        digit1 = len(str(divide))
        digit2 = len(str(candidate))
        answer = min(answer, max(digit1, digit2))

print(answer)

Submission status: Accepted

Solution code:
N = int(input())
ans = 100000
for i in range(1, 17 * 10 ** 6):
    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 = 100000
for i in range(1, 15 * 10 ** 6):
    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 = 100000
for i in range(1, 13 * 10 ** 6):
    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 = 100000
for i in range(1, 10 ** 7):
    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 = 100000
for i in range(1, 10 ** 5):
    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())
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]
yakusuu=make_divisors(N)
if len(yakusuu)%2 != 0:
    print(len(str(yakusuu[len(yakusuu)//2])))
else:
    ans=pow(10,9)
    for n in range(len(yakusuu)//2):
        number=max(len(str(yakusuu[n])),len(str(yakusuu[-n-1])))
        ans=min(ans,number)
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
f = lambda x,y:len(str(x)) if x > y else len(str(y))
from math import floor, sqrt
ans = len(str(N))
for a in range(1,floor(sqrt(N))+1):
    if N % a == 0:
        ans = min(ans, f(a,N//a))
print(ans)

Submission status: Accepted

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

def makedivisors(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 = makedivisors(n)
m = 10**9
for a in range(len(l)):
    for b in range(len(l)):
        if l[a] * l[b] == n:
            m = min(m,digit(l[a],l[b]))
print(m)

Submission status: Accepted

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

def makedivisors(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 = makedivisors(n)
m = 10**9
for a in range(len(l)):
    for b in range(a,len(l)):
        if l[a] * l[b] == n:
            m = min(m,digit(l[a],l[b]))
print(m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
from math import sqrt, log10

def divisor(num):
    max_num = int(sqrt(num))
    divisor_list = []
    for i in range(1, max_num + 1):
        if num % i == 0:
            divisor_list.append(i)
            # divisor_list.append(num//i)
    return divisor_list
ans = float("inf")
for div in divisor(N):
    a = div
    b = N//div
    da = int(log10(a)) + 1
    db = int(log10(b)) + 1
    ans = min(ans, max(da,db))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n=int(input())
ans=10**11
for i in range(1,math.floor(math.sqrt(n)+1)):
    if n%i == 0:
        a=i
        b=n//i
        a_len=len(str(a))
        b_len=len(str(b))
        ans=min(ans,max(a_len,b_len))
print(ans)

Submission status: Accepted

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

print(len(str(ans)))

Submission status: Accepted

Solution code:
# vim: fileencoding=utf-8


def main():
    n = int(input())
    ans = len(str(n))
    for a in range(2, int(pow(n, 0.5) + 1)):
        if n % a != 0:
            continue
        b = n // a
        l = max(len(str(a)), len(str(b)))
        if ans > l:
            ans = l
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def func(n) :
    i = 1
    b = n
    while i*i <= n :
        if n % i == 0 :
            if max(len(str(i)), len(str(n//i))) < b :
                b = max(len(str(i)), len(str(n//i)))
        
        
        i += 1
    
    return print(b)        

n = int(input())
func(n)

Submission status: Accepted

Solution code:
import math
N = int(input())
INF = float("inf")
for a in range(1, int(math.sqrt(N)) + 1):
    if N % a != 0:
        continue
    b = int(N / a)
    a = list(map(int, str(a)))
    b = list(map(int, str(b)))
    length = max(len(a), len(b))
    if INF > length:
        INF = length
print(INF)

Submission status: Accepted

Solution code:
# coding: utf-8
import math
import copy
import itertools
n = int(input())
flg=False
for i in range(int(math.sqrt(n))+1, 0,-1):
    #print(i)
    if n%i==0:
        a=i
        b=n//a
        flg=True
        break
if flg:
    print(max(len(str(a)), len(str(b))))
else:
    print(len(str(n)))

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = len(str(n))
for i in range(1,int(math.sqrt(n))+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

n = int(input())
ans = float('inf')
for a in range(1, int(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:
def divisor(n):
    l = []
    ll = []
    for i in range(1, int(n**0.5)+1):
        if n%i == 0:
            l.append(i)
            # ll.append(n//i)
    # l += reversed(ll)
    # l = sorted(list(set(l)))
    return l


n = int(input())
l = divisor(n)
ans = 100100100100

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())

min_f = len(str(N))
for a in range(1, int(math.sqrt(N)) + 1):
  if N % a != 0:
    continue
  b = int(N / a)
  f = max(len(str(a)), len(str(b)))
  if min_f > f:
    min_f = f

print(min_f)

Submission status: Accepted

Solution code:
import math
n = int(input())
best = math.inf
cmb = None
for i in range(int(math.sqrt(n))):
    i+=1
    if n%i==0:
        if best>n//i-i:
            best=n//i-i
            cmb=i

print(int(math.log10(n//cmb))+1)

Submission status: Accepted

Solution code:
import math

N = int(input())
m = int(math.sqrt(N)) + 1

a = N
for i in range(1, m):
  if N % i == 0:
    a = N / i
print(int(math.log10(a) + 1))

Submission status: Accepted

Solution code:
n = int(input())
tmp = n
ans = n
y = tmp **0.5
o = int(y // 1)
for i in range(o+1):
    a=i+1
    #print("a:"+str(a))
    b=n/(i+1)
    #print("b:"+str(b))
    #print("a*b:"+str(a*b))
    if (b.is_integer()==True ):
        kari = max(len(str(a)),len(str(int(b))))
        #print("kari:"+str(kari))
        ans = min(ans,kari)
print(ans)

Submission status: Accepted

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

i = 1
while i*i <= n:
    if n % i == 0:
        if ans > max(len(str(i)), len(str(n//i))):
            ans = max(len(str(i)), len(str(n//i)))
    i += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def I(): return int(sys.stdin.readline().rstrip())


N = I()
divisor = []
for i in range(int(N**.5),0,-1):
    if N % i == 0:
        if i != N//i:
            print(max(len(str(i)),len(str(N//i))))
        else:
            print(len(str(i)))
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n=int(input())

#a<bとすると、aの最大値は
amax=int(math.sqrt(n))

total=[]

for i in range(1,amax+1):
    if n%i==0:
        b=n//i
        total.append(len(str(b)))
        
print(min(total))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    m = 1
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            m = i
    m_ = n//m
    print(max(len(str(m_)),len(str(m))))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
n = int(input())
m = int(math.sqrt(n))
s = list()
for i in range(1,m+1):
    if n % i == 0:
        s.append(n/i)
    else:
        continue
print(len(str(int(min(s)))))

Submission status: Accepted

Solution code:
def check(n):
    min_len = 1 << 60
    for i in range(1, int(n**.5 + 1)):
        if n % i == 0:
            a= i
            b= n//i
            min_len = min(min_len, max(len(str(a)), len(str(b))))
    return min_len


n = int(input())
res = check(n)
print(res)

Submission status: Accepted

Solution code:
n = int(input())

sol = n
for i in range(round(n**0.5), 1, -1):
    if n%i == 0:
        sol = n//i
        break

print(len(str(sol)))

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())
li = make_divisors(N)
ans = []
if len(li) % 2 == 1:
    ans.append(len(str(li[len(li)//2])))
else:
    ans.append(len(str(li[len(li) // 2])))
    ans.append(len(str(li[len(li) // 2 - 1])))
print(max(ans))

Submission status: Accepted

Solution code:
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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
lst=make_divisors(n)

ans=float('inf')
for i in lst:
    # print(i)
    ans=min(ans,max(len(str(i)),len(str(n//i))))
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

Submission status: Accepted

Solution code:
N = int(input())

import math
a = math.floor(math.sqrt(N))
amax = 1
for i in range(1, a+1):
    if N % i == 0:
        amax = i

print(math.floor(math.log10(N//amax)) + 1)

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = float('inf')
i = 1
while i <= math.sqrt(n):
    if n % i == 0:
        a = int(len(str(i)))
        b = int(len(str(n // i)))
        ans = min(ans,max(a,b))
    i += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())

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

    return d

F = digit(N)

for n in range(1, int(math.sqrt(N)) + 1):
    if N % n != 0:
        continue
    else: # N % n == 0
        F = min(F, max(digit(n), digit(N // n)))

print(F)

Submission status: Accepted

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

n = k()

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

val = []
for i in range(m):
    if n % (i+1) == 0:
        val.append(len(str(n//(i+1))))
print(min(val))

Submission status: Accepted

Solution code:
n = int(input())

import math
m = math.ceil(math.sqrt(n))

val = []
for i in range(m):
    if n % (i+1) == 0:
        val.append(len(str(n//(i+1))))
print(min(val))

Submission status: Accepted

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

ans=[]
is_prime = [True] * (int(N**(0.5))+1)
is_prime[0] = False
for i in range(1,int(N**(0.5))+1):
    if not is_prime:
        continue
    if N%i==0:
        ans.append([i,N//i])
    else:
        for j in range(i,int(N**(0.5))+1,i):
            is_prime[j]=False

z=10
for A in ans:
    z=min(z,int(math.log10(A[1])))

print(z+1)

Submission status: Accepted

Solution code:
n = int(input())

ans = 1
for i in range(2, 10 ** 5):
    if n % i == 0:
        ans = i
    if i * i > n:
        break

print(len(str(n // ans)))

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, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
#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)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
#mod = 10**9 + 7
#mod = 9982443453
mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
#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, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
#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)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
import math
root = int(math.sqrt(n))+1
ans = float('inf')
for i in range(1,root+1):
    if n%i == 0:
        left = i
        right = n//i
        ll = len(str(left))
        lr = len(str(right))
        lm = max(ll,lr)
        ans = min(ans,lm)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

ans_len = max(len(str(ans)), len(str(N//ans)))

print(ans_len)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 11
for i in range(1, int(n ** (1/2)) + 1):
    if n % i == 0:
        ans = min(ans, max(map(lambda x: len(str(x)), [i, n//i])))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

    #divisors.sort(reverse=True)
    return divisors

d = make_divisors(n)
ans = 10**18
for a in d:
    b = n//a
    a = str(a)
    b = str(b)
    ans = min(ans, max(len(a), len(b)))
print(ans)

Submission status: Accepted

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


def f(x, y):
    return max(map(lambda z: len(str(z)), [x, y]))


N = int(input())
divs = enum_div_pairs(N)
print(min(f(x, y) for x, y in divs))

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
#n, m = map(int, input().split())
#xl = list(map(int, input().split()))
#al=[list(input()) for i in range(n)]
a=1
ans=len(str(n))
while a**2<=n:
    if n%a==0:
        b=n//a
        ans=min(ans, max(len(str(a)),len(str(b))))
    a+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

a = len(str(N))
i = 1
while i*i <= N:
    if N % i == 0:
        a = min(a, len(str(N//i)))
    i += 1

print(a)

Submission status: Accepted

Solution code:
import math
n=int(input())
l=math.floor(math.sqrt(n))
k=math.floor(math.log10(n))+1

for i in range(2,l+1):
    if n%i==0:
        a,b=i,n//i
        x=max(math.floor(math.log10(a))+1,math.floor(math.log10(b))+1)
        k=min(x,k)
print(k)

Submission status: Accepted

Solution code:
N=int(input())
def f(n):
    for i in range(int(n**.5),0,-1):
        if n%i==0:
            return n//i
print(len(str(f(N))))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import sqrt,ceil
n=int(input())
a=ceil(sqrt(n))
l=[]
p=[]
for i in range(1,a+1):
    if n%i==0:
        l.append([i,n//i])
        x=len(str(i))
        y=len(str(n//i))
        p.append(max(x,y))

print(min(p))

Submission status: Accepted

Solution code:
# coding = SJIS

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

for i in range(1, int(n ** (1/2)) + 1):
    if i * int((n / i)) == n:
        ans = min(ans, len(str(int(n / i))))
print(ans)

Submission status: Accepted

Solution code:
from math import sqrt
n = int(input())
start = int(sqrt(n) // 1)
low_share = 0

for i in range(start,0,-1):
    if n % i == 0:
        low_share = i
        break

high_share = int(n/low_share)
ans = len(str(high_share))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

import math
def dig(n):
    for i in range(1,12):
        if n<10**i:
            return i

n = inn()
mn = BIG
en = int(math.sqrt(n))+2
for i in range(1,en):
    if n%i==0:
        mn = min(mn,dig(n//i))
print(mn)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def Divisor(N):
    Left,RightRev = [],[]
    I = 1
    while I*I<=N:
        if N%I==0:
            Left.append(I)
            if I!=N//I:
                RightRev.append(N//I)
        I += 1
    Div = Left+RightRev[::-1]
    DivCount = len(Div)
    return Div,DivCount
  
N = int(input())
Div,_ = Divisor(N)
FABMax = len(str(N))
for A in Div:
    B = N//A
    if A>B:
        break
    FABMax = min(FABMax,max(len(str(A)),len(str(B))))
print(FABMax)