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:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    print((a+b)%24)
    return

#B
def B():
    n, m = LI()
    ab = LIR(n)
    cd = LIR(m)
    for a, b in ab:
        ans = inf
        an = 0
        for num, cdi in enumerate(cd):
            c, d = cdi
            if ans > abs(a - c) + abs(b - d):
                ans = abs(a - c) + abs(b - d)
                an = num
        print(an+1) 
    return

#C
def C():
    n = II()
    ans = inf
    for i in range(1, int(math.sqrt(n)) + 1):
        if not n % i:
            ans = min(ans, max(int(math.log(i, 10)), int(math.log(n // i, 10))))
    print(ans+1)
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()

Submission status: Accepted

Solution code:
N = int(input())
def is_square(n):
    m = int(n**.5)
    return True if abs(m*m - n) < 1e-6 else False
divs = []
f = False
if is_square(N):
    divs = [int(N**.5)]*2
    f = True
for i in range(int(N**.5),0,-1):
    if f: break
    if N % i == 0: divs += [i, N//i]
    if len(divs) >= 2: break
print(max([len(str(x)) for x in divs]))

Submission status: Accepted

Solution code:
import math
def digit_num(N):
    if N < 10:
        return 1
    return 1 + digit_num(N // 10)

N = int(input())
ans = 15
for i in range(1, int(math.sqrt(N)) + 1):
    if N % i == 0:
        ans = min(ans, max(digit_num(i), digit_num(N // i)))
        
print(ans)

Submission status: Accepted

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

n = int(input())
#tmp = input().split()
#hoge = list(map(lambda a: int(a), tmp))

tmp= math.ceil(math.sqrt(n))
#print(n)
#print(tmp)
for i in range(0,tmp):
	if(n%(tmp-i)==0):
		break

#print(tmp-i)
ansn=n//(tmp-i)
#print(ansn)
#print(math.log10(ansn))
#print(max(ansn,tmp-i))
#print(math.floor(0.9))
ans=math.floor(math.log10(max(ansn,tmp-i))) + 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def F(A):
     return len(str(A))

upper_bound = int(N ** (0.5))
ans = float("inf")
for i in range(1, upper_bound + 1):
     if N % i == 0:
          j = N // i
          ans = min(ans, F(j))
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
m=int(N**0.5)
while True:
    if N%m==0:
        print(len(str(N//m)))
        exit()
    else:
        m-=1

Submission status: Accepted

Solution code:

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def main():
    num = int(input())
    ans = len(str(num))
    for i in range(1, int(num ** 0.5) + 1):
        if num % i == 0:
            # print(i)
            a = i
            b = num // a
            kari = max(len(str(a)), len(str(b)))
            ans = min(ans, kari)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def m_c_d(x, y):
    if x == 0:
        return y
    elif y == 0:
        return x
    else:
        return m_c_d(y, x % y)


a = int(input())
b = 0
for i in range(int(a ** 0.5 + 1), 1, -1):
    b = max(m_c_d(a, i), b)
print(max(len(str(b)), len(str(a // b))))

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
small = [1]
large = [n]
for i in range(2,int(n**0.5)+1):
    if not (n%i):
        small.append(i)
        large.append(n//i)
print(int(math.log10(large[-1]))+1)

Submission status: Accepted

Solution code:
import sys
from math import sqrt

def solve(N):
    def f(a, b):
        return max([ len(str(x)) for x in [a, b] ])

    m = float('inf')
    i = 1
    imax = sqrt(N)
    while i <= imax:
        if N % i == 0:
            m = min(m, f(i, N // i))
        i += 1

    print(m)

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
import itertools

INF = 10**9+7
n = 0
def main():
	ans = INF
	n = int(input())
	for i in range(1,int(math.sqrt(n)) + 1):
		if(n%i==0):
			m = int(n/i)
			d = div(m)
			if(ans > d):
				ans = d

	print(ans)

def div(n):
	ans = 1
	while n >= 10:
		ans+=1
		n/=10
	return ans

main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
N = int(input())
mi = float("inf")
def F(x, y):
    return max(len(str(x)), len(str(y)))

for A in range(1, math.floor(math.sqrt(N))+1):
    if N % A == 0:
        B = N // A
        mi = min(F(A, B), mi)
print(mi)

Submission status: Accepted

Solution code:
import math

n = int(input())

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

ans_min = len(str(n))
for a in range(1, int(math.sqrt(n)) + 1):
    if n % a == 0:
        ans = compare_digits(a, int(n / a))
        if ans < ans_min:
           ans_min = ans

print(ans_min)

Submission status: Accepted

Solution code:
n = float(input())

chk1 = 0
chk2 = 0
max_len = 100000000000

for i in range(1,int(n**0.5)+1):
    #n=i*chk
    chk = n/i
    if chk.is_integer():
        i_len = len(str(i))
        chk_len = len(str(int(chk)))
        if max(i_len,chk_len) < max_len:
            #print(i,chk,":",i_len,chk_len)
            max_len = max(i_len,chk_len)

print(max_len)

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = 10 ** 10
for i in range(1,math.floor(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:
# -*- coding: utf-8 -*-

import math

def main(N):
    A = []
    for i in range(1, int(math.sqrt(N))+1):
        if(N%i==0):
            A.append(i)
    ans = float("INF")
    for i in range(len(A)):
        ans = min(ans, F(A[i], int(N/A[i])))
    print(ans)
    
def F(A, B):
    if len(str(A))>=len(str(B)):
        return len(str(A))
    else:
        return len(str(B))

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

Submission status: Accepted

Solution code:

N = int(input())

cnt = 1
ans = float("inf")

while cnt ** 2 <= N:

    now = 0

    if N % cnt == 0:

        now = N // cnt

        keta = 1
        while True:

            if 10 ** keta > now:
                break
            keta += 1

        ans = min (keta,ans)

    cnt += 1

print (ans)

Submission status: Accepted

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

import math


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    N, = read_h()

    ans = 100
    for a in range(1, int(math.sqrt(N)) + 1):
        if N % a != 0:
            continue

        b = N // a
        f = max(len(str(a)), len(str(b)))
        ans = min(ans, f)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

    divisors.sort()
    return divisors

div = make_divisors(N)
div2 = div.copy()
div2.reverse()
n = len(div2)//2
print(max(len(str(div[n])), len(str(div2[n]))))

Submission status: Accepted

Solution code:
N = int(input())

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

    # divisors.sort()
    return divisors

X = make_divisors(N)
ans = 10

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = float('inf')
for i in range(1, N_sqrt + 1):
    if N % i == 0:
        if ans > max(len(str(i)), len(str(N // i))):
            ans = max(len(str(i)), len(str(N // i)))

print(ans)

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

Submission status: Accepted

Solution code:
import math

def calc(N):
    ans = N

    v2 = int(math.sqrt(N))
    if N == v2 * v2:
        ans = v2 
    else:
        v3 = v2 + 1
        for v in range(2, v3):
            div = int(N / v)
            if div * v == N:
                rc = max(v, div)
                if rc < ans:
                    ans = rc

    return ans


N = int(input())
v = calc(N)
print(len(str(v)))

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

Submission status: Accepted

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

result = 10 * 2
N = int(input())
for d in range(1, N + 1):
    if d * d > N:
        break
    if N % d == 0:
        result = min(result, max(digit_len(d), digit_len(N // d)))
print(result)

Submission status: Accepted

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

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

    mn = 10 ** 10
    for i in n1:
        mn = min(mn, max(len(str(n // i)), len(str(i))))
    print(mn)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(N: int):
    i = 1
    ret = float('inf')
    while i * i <= N:
        if N % i == 0:
            tmp = N // i
            ret = min(ret, max(len(str(i)), len(str(tmp))))
        i += 1
    print(ret)
    return


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:
N = int(input())
def count_order(x):
    count = 1
    while True:
        x = int(x/10)
        if x != 0:
            count += 1
        else:
            break
    return count

def F(A,B):
    a = count_order(A)
    b = count_order(B)
    if a > b:
        return a
    else:
        return b
min_order = 10
for A in range(1, int(N**0.5)+1):
    if N % A == 0:
        B = N / A
        
        order = F(A,B)
        if order < min_order:
            min_order = order
print(min_order)

Submission status: Accepted

Solution code:
import numpy as np

# 整数Nを入力する
N = int(input())

# 整数A、Bの桁数のうち、大きい方を返す関数F(A, B)を定義
def F(A, B):
    C = np.vstack((A, B))
    digit_C = np.array(np.log10(C) + 1, dtype = int)
    return np.max(digit_C, axis = 0)

# 除数の配列を作成
divisor = np.arange(1, int(N ** 0.5) + 1)
# 商および余りを計算
quotient = N // divisor
residue = N % divisor

# N = A * B となるようなAおよびBの配列を作成
A = divisor[residue == 0]
B = quotient[residue == 0]

# F(A, B)の最小値を返す
print(np.min(F(A, B)))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import math

N = int(input())
min_len = pow(10,10)

for i in range(1, math.ceil(math.sqrt(N)) + 1):
    if N % i == 0:
        if (len(str(i)) >= len(str(N // i))) and (min_len > len(str(i))):
            min_len = len(str(i))
        elif (len(str(i)) < len(str(N // i))) and (min_len > len(str(N // i))):
            min_len = len(str(N // i))
        else:
            continue
print(min_len)

Submission status: Accepted

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

Submission status: Accepted

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

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

l=make_divisors(n)
ans=10**9+7
for i in l:
    ans=min(ans,f(i,n//i))

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a,b=0,0
for i in range(1,n+1):
    if n%i==0:
        a=i
        b=n//i
    if i>n//i:
        break

alog,blog=1,1
i=0
while 1:
    a=a//10
    if a==0:
        break
    alog+=1

while 1:
    b=b//10
    if b==0:
        break
    blog+=1

print(max(alog,blog))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
	N = int(input())
	d_i, d_div = 0, 0
	sqrt = int(N**0.5)
	for i in range(1, sqrt+1):
		div, mod = divmod(N, i)
		if mod == 0:
			d_i = i
			d_div = div
	ans = 0
	while d_div != 0:
		ans += 1
		d_div //= 10
	print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# ABC057C - Digits in Multiplication
def factorize(x: int) -> list:
    ret = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            ret = [i, x // i]
    return ret


def main():
    n = int(input())
    a, b = factorize(n)
    print(max(len(str(a)), len(str(b))))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# ABC057C - Digits in Multiplication
def factorize(x: int) -> list:
    pairs = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            pairs += [(i, x // i)]
    return pairs


def main():
    n = int(input())
    a, b = factorize(n)[-1]
    print(max(len(str(a)), len(str(b))))


if __name__ == "__main__":
    main()

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(len(str(int(N/i))))
print(min(result))

Submission status: Accepted

Solution code:
n=int(input())
s=int(n**(1/2))+1
l=[]
for i in range(1,s+1):
  if n%i==0:
    l.append([i,n//i])
def digit(a,b):
  return max(len(str(a)),len(str(b)))
ans=11
for i in range(len(l)):
  if ans>=digit(l[i][0],l[i][1]):
    ans=digit(l[i][0],l[i][1])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

def keta(num):
  b = num
  count=0
  while b >= 1 :
    count+=1
    b= b//10
  return count

n = int(input())

min_f = keta(n)
for i in range(1, int(math.sqrt(n))+1):
  if n%i==0:
    f = max(keta(n//i),keta(i))
    if min_f > f:
      min_f = f
print(min_f)

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)

B = N // A[-1]
print(len(str(B)))

Submission status: Accepted

Solution code:
import numpy as np
import copy


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

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

    assert t > 0
    n_digits = len(str(t))

    print(n_digits)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

for i in range(10):
    if x <10**(i+1) and x >= 10**i:
        print(i+1)
        break

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for A in range(1,int(N**0.5)+1):
    if N/A==int(N/A):
        ans=min(ans,len(str(int(N/A))))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

from math import log10,ceil,floor
mini = int(log10(N))
digit =  floor(log10(N)**0.5)
for n in range(1,int(N**0.5) + 1):
    if N % n == 0:
        rev = N // n
        if floor(abs(log10(max(n,rev))-digit)) < floor(abs(mini - digit)):
            mini = floor(log10(max(n,rev)))
print(mini + 1)

Submission status: Accepted

Solution code:
n = int(input())
a = 0
t = 0
for i in range(1, n+1):
    a = n / i
    if(n % i == 0):
        t = i
    if(a <= i):
        break

b = max(int(n / t), t)
ans = 0
while(b >= 1):
    ans += 1
    b /= 10
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = len(str(n))
a = 0
while a**2 <= n:
    a += 1
    if n % a != 0:
        continue
    b = n // a
    cur = max(len(str(a)), len(str(b)))
    if ans > cur:
        ans = cur
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 1e9
for i in range(1, int(n**(1/2))+1):
  j = n/i
  if j.is_integer():
    j = int(j)
    ans = min(ans, max(len(str(i)), len(str(j))))
print(ans)

Submission status: Accepted

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

a = 1
b = 1

'''
def get_prime(num):
    primes = {}
    origin_num = num
    primes[1] = 1

    tmp = int(math.sqrt(num) + 1)

    for i in range(2, tmp):
        while num % i == 0:
            num //= i

            if not (i in primes.keys()):
                primes[i] = 0
            primes[i] += 1

    if num != 1:
        primes[num] = 1

    if num == origin_num:
        primes[num] = 1

    return primes


prime_dic = get_prime(n)
prime_sorted = sorted(prime_dic.items(), key=lambda x: x[0], reverse=True)

for k, v in prime_sorted:
    for i in range(v):
        if a <= b:
            a *= k
        else:
            b *= k
'''


tmp = int(math.sqrt(n) + 1)

for i in range(1, tmp):
    if n % i == 0:
        a = i

b = int(n / a)

f = max(len(str(a)), len(str(b)))

print(f)

Submission status: Accepted

Solution code:
from math import sqrt

N = int(input())

n = int(sqrt(N)) + 10
def f(A, B):
    a = len(str(A))
    b = len(str(B))
    return max(a, b)


ans = 10 ** 10
for i in range(1, n):
    if (N//i) * i == N:
        ans = min(ans, f(i, N//i))

print (ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = float("inf")
for a in range(1, int(n ** 0.5) + 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:
n=int(input())
ans=10000000000000000
for i in range(1,int(n**0.5+1)):
    if n%i==0:ans=min(ans,len(str(n//i)))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
N = int(input())
B = N
for x in range(1,N+1):
  y = N//x
  if x > y:
    break
  if not N % x:
    B = y
    
answer = len(str(B))
print(answer)

Submission status: Accepted

Solution code:
n = int(input())
i = 1
num = 100000
while i <= n / i:
        if n % i == 0:
                num = min(num, max(len(str(i)), len(str(int(n/i)))))
        i += 1
print(num)

Submission status: Accepted

Solution code:
n = int(input())
pf={}
for i in range(1,int(n**0.5) + 1):
    if n % i == 0:
      pf[i] = pf.get(i,0) + 1
a = max(pf)
b = int(n/a)
ans = max(len(str(a)), len(str(b)))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

answer = 10 ** 12
for i in range(1, int(N**(1/2))+1):
  if N % i == 0:
    answer = min(answer, max(len(str(i)), len(str(N//i))))

print(answer)

Submission status: Accepted

Solution code:
import math
N = int(input())
Upper = int(math.sqrt(N))+1
ans = len(str(N))

for i in range(1,Upper):
    if N%i == 0:
        ans = min(ans,len(str(N//i)))
print(ans)

Submission status: Accepted

Solution code:
def keta(n):
    cnt = 0
    while n>0:
        n=n//10
        cnt+=1
    return cnt
n = int(input())
minans = 10**10
i=0
while i**2<=n:
    i+=1
    if n%i!=0:
        continue
    j = n/i
    ans = max(keta(i),keta(j))
    minans=min(minans,ans)
    i+=1
print(minans)

Submission status: Accepted

Solution code:
n=int(input())
ans=20
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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import math

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

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


# print(ndigits(N))
r = int(math.sqrt(N))

for i in range(r,0,-1):
  # print(i)
  if N%i == 0:
    break

print(max(ndigits(i), ndigits(N/i)))

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())

sqrt_n = int(round(np.sqrt(n)))

i = 0 

while True:
    if n % (sqrt_n+i) == 0:
        ans = [sqrt_n+i,int(n/(sqrt_n+i))]
        break
    
    if n % (sqrt_n-i) == 0:
        ans = [sqrt_n-i,int(n/(sqrt_n-i))]
        break
    
    i += 1

len_ans = [0,0]

len_ans[0] = len(str(ans[0])) 
len_ans[1] = len(str(ans[1])) 

print(max(len_ans))

Submission status: Accepted

Solution code:
import numpy as np

n=int(input())

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

ans=10*20
for i in range(int(np.sqrt(n))):
    if n%(i+1)==0:
        F=f(i+1,n//(i+1))
        if F<ans:
            ans=F
print(ans)

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
# Nが素数のときはNの桁数しかない
# 3桁*3桁 = 6桁 3桁*4桁=6~7桁 2桁*6桁=7~8桁なのでNの桁数がわかればA,Bの桁数が分かる
# A<=BとするとN=10だと(1,9)|(1,10)(2,8)|(2,9)(3,7)|(3,8)(4,6)|(4,7)|(5,5)
# * 最初の(1,9)の一桁では1は素数で省かれているので除く
# なのでせいぜい10^5まで調べりゃいい
n = int(input())


def f(t):
    keta = 0
    while t > 0:
        keta += 1
        t //= 10
    return keta


flag = False
for i in range(2, int(n ** 0.5) + 1):
    if n % i == 0:
        flag = True
        break

if flag is False:
    print(f(n))
    exit()

maxn = 10**9
for a in range(2, 10 ** 6):
    if n % a == 0:
        b = n / a
        maxn = min(maxn, max(f(b), f(a)))

print(maxn)

Submission status: Accepted

Solution code:
import math

def func(a, b):
	if len(str(a)) > len(str(b)): return len(str(a))
	return len(str(b))
N = int(input())
start = int(math.sqrt(N))
for i in range(0, start):
	if N%(start-i) == 0:
		print(func(start-i, N//(start-i)))
		break

Submission status: Accepted

Solution code:
n = int(input())
f = float('inf')
for a in range(1, int(n**0.5)+1):
    if n % a == 0:
        b = n // a
        x = max(len(str(a)), len(str(b)))
        if f > x:
            f = x
print(x)

Submission status: Accepted

Solution code:
N = int(input())

## Nの正の公約数をリストで返す（ソートしたい場合は#外す）
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の桁数を出力する
## 10**(out-1) <= in < 10**out
def int2digit(num):
  return(len(str(num)))

lst = make_divisors(N)
B = N // lst[-1]
ans = int2digit(B)

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())

from math import sqrt,log10
#1~sqrt(n)まで探索すれば良い
ret = 11
for i in range(1,int(sqrt(n)+1)):
    if n%i==0:
        ret = min([ret,log10(n//i)+1])
print(int(ret))

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = 10**10

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

print(len(str(int(ans))))

Submission status: Accepted

Solution code:
N = int(input())

a = 1
b = 1
buff = 1

def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

_list = divisor(N)
_list = sorted(_list)
med = len(_list)

if med % 2 == 0:
    ans = str(_list[int(med/2)])
else:
    ans = str(_list[med//2])

print(len(ans))

Submission status: Accepted

Solution code:
N = int(input())
a = 1
ans = 10
while a*a <= N:
    b, r = divmod(N, a)
    if r == 0:
        ans = min(ans, len(str(b)))
    a += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def keta(cnt,a):
    if 0 < a and a <= 9:
        return cnt 
    else : 
        cnt += 1
        a = a // 10
        
    return keta(cnt,a)

def zyou(a):
    n = 1
    while True :
        if a < n**2 :
            return n
        else : n += 1 
n = zyou(N)

for i in range(n,0,-1):
    if N % i == 0 :
        print("{}".format(keta(1,max(i,N//i))))
        break

Submission status: Accepted

Solution code:
import math
n = int(input())
f = 100
for i in range(1, math.floor(math.sqrt(n))+1):
    if n % i != 0: continue
    f = min(f, max(int(math.log10(i)+1), int(math.log10(n/i)+1)))
print(f)

Submission status: Accepted

Solution code:
import math
N = int(input())
lim = int(math.sqrt(N))
ans = 9999
for i in range(1,lim+1):
    if N % i == 0:
        temp = N //i
        cand = max(len(str(i)),len(str(temp)))
        if ans > cand:
            ans = cand


print(ans)

Submission status: Accepted

Solution code:
from math import floor, sqrt

n = int(input())
n_root = floor(sqrt(n))

result = 10000000000
for a in range(1, n_root + 1):
    if not n % a == 0:
        continue
    b = int(n / a)
    digit_a = len(str(a))
    digit_b = len(str(b))
    tmp = max(digit_a, digit_b)
    result = min(tmp, result)

print(result)

Submission status: Accepted

Solution code:
import math
N=int(input())
def F(a,b):
    al = len(str(a))
    bl = len(str(b))
    if al < bl:
        return bl
    else:
        return al

min = 10
for A in range(1,int(math.sqrt(N))+1):
    if N % A == 0:
        B = N // A
        f = F(A,B)
        if f < min:
            min = f
print(f)

Submission status: Accepted

Solution code:
def func(a, b):
	return max(map(len, map(str, [a, b])))

N = int(input())

min_dig = 10 ** 18
for i in range(1, int(N ** 0.5) + 1):
	if not N % i:
		j = N // i
		min_dig = min(min_dig, func(i, j))

print(min_dig)

Submission status: Accepted

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


a = 1 #aはnの約数の中で大きい奴
b = 1 #bはaと対応する奴（a*b=nの意味）

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

Submission status: Accepted

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

for a in range(1, ns+1):
    if n%a == 0:
        b = n//a
        a_s = str(a)
        b_s = str(b)
        ans.append(max(len(a_s),len(b_s)))

print(min(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

l = input().split()
N = int(l[0])

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

def f(a, b):
    da = digits(a)
    db = digits(b)
    return max(da, db)

limit = int(math.sqrt(N) + 1)
# print(limit)

ans = 11

for i in range(1, limit):
    d = N // i
    if d*i == N:
        ans = min(ans, f(i, d))

print(ans)

Submission status: Accepted

Solution code:
import math
n=int(input())
for i in reversed(range(1,math.floor(math.sqrt(n))+1)):
    if n%i==0:
        tmp=i
        break
print(math.floor(math.log10(max(tmp,n//tmp)))+1)

Submission status: Accepted

Solution code:
#divisor
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 = 10**10
for i in li:
    b = N//i
    ans = min(ans,max(len(str(i)),len(str(b))))

print(ans)