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:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    N = int(sys.stdin.readline())

    for N_ in range(math.floor(math.sqrt(N)), -1, -1):
        if N % N_ == 0:
            M = N // N_
            print(len(str(M)))
            return

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
i = round(n**.5)
while n%i != 0:
  i -= 1
print(len(str(n//i)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n = int(input())
def f(n):
  g = float('inf')
  for i in [j for j in range(1,math.ceil(n**0.5)+1) if n%j == 0]:
    if g > len(str(max(i,n//i))):
      g = len(str(max(i,n//i)))
    if g == float('inf'):
        g = 1
  return g
print(f(n))

Submission status: Accepted

Solution code:
n = int(input())
ans = len(str(n))
for a in range(1, round(n ** (1/2)) + 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())

ans = 0
start = math.ceil(math.sqrt(N))
while ans == 0:
    if N%start == 0:
        ans = max(len(str(int(start))),len(str(int(N/start))))
    start -= 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

m = int(N **0.5)+1
for i in range(1,m):
    j = N // i
    if i*j < N:
        continue
    k = i
a = N // k
ans=0
b = str(a)
ans = len(b)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
list = []
for i in range(int(N/2)+1):
    A = i+1
    B = N / A
    if A > B:
        break
    #print(A,B,int(A)*int(B))
    if int(A) * int(B) == N:
        if len(str(int(A))) >= len(str(int(B))):
            list.append(len(str(int(A))))
        else:
            list.append(len(str(int(B))))
#print(list)
print(min(list))

Submission status: Accepted

Solution code:
import math

N = int(input())
A = []
B = []
F = []

for i in range(1,int(math.sqrt(N))+1,1):
    if (N%i)== 0:
        A.append(N/i)
        B.append(i)
for i in range(len(A)):
    count_A = int(math.log10(A[i])+1)
    count_B = int(math.log10(B[i])+1)
    if count_A >= count_B:
        F.append(count_A)
    else:
        F.append(count_B)
print(min(F))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())
if N <= 9:
    ans = 1
else:
    ans = 11
for n in range(1, int(math.sqrt(N))+1):
    if N % n == 0:
        # print(n)
        f = max(len(str(n)), len(str(int(N/n))))
        if f < ans:
            # print("f: %d"%f)
            ans = f
print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())
N_max = math.floor(pow(N, 0.5))

ans = math.floor(math.log10(N)) + 1

for i in range(1, N_max+1):
    if N % i == 0:
        M = N / i
        digI = math.floor(math.log10(i)) + 1
        digM = math.floor(math.log10(M)) + 1
        if digI >= digM:
            score = digI
        else:
            score = digM

        if score <= ans:
            ans = score

print(ans)

Submission status: Accepted

Solution code:
from math import sqrt, floor
N = int(input())
a = 1
for i in range(2, floor(sqrt(N)) + 10):
    if N % i == 0:
        a = i

print(max(len(str(a)), len(str(N // a))))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# Luis Yoichi Morales January 2019



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

Submission status: Accepted

Solution code:
N = int(input())
larger = 0
for i in range(1, N + 1):
    if i*i > N:
        break
    if N % i == 0:
        larger = N // i

ans = 0
while larger > 0:
    ans += 1
    larger //= 10
print(ans)

Submission status: Accepted

Solution code:
import math

# n以下の素数を列挙
def Primes(n):
    Prime = []
    Table = list(range(2, n+1))
    for k in range(2, int(math.sqrt(n))+1):
        if k == Table[0]:
            Prime.append(Table[0])
            Table = [i for i in Table if i % k]
    return Prime + Table if n >= 2 else []


# 素因数分解
def PrimeDecomp(m):
    n = m
    Dict = {}
    for p in Primes(int(math.sqrt(m))):
        for _ in range(1, m):
            if n % p == 0:
                n //= p
                Dict.setdefault(p, 0)
                Dict[p] += 1
            else:
                break
    if n > 1:
        Dict[n] = 1
    return Dict


# 約数列挙
def Divisors(m):
    Divisor = [1]
    for p in PrimeDecomp(m).keys():
        Table = []
        for j in range(PrimeDecomp(m)[p]+1):
            Table.extend([d*p**j for d in Divisor])
        Divisor = Table
    return sorted(Divisor)


Div = Divisors(int(input()))
print(len(str(Div[len(Div)//2])))

Submission status: Accepted

Solution code:
import math

#入力
N = int(input())
minF = 100 #Fの最小値

#A = 1のとき
F = int(math.log10(N)) +1
if F < minF:
    minF = F
    
for A in range(2,int(math.sqrt(N)) + 1):
    #AがBの約数でなかったら飛ばす
    if N % A == 0:
        B = N / A
        #F = culculate_F(A,B)
        F = int(math.log10(B)) + 1
        #Fがこれまでで最小ならminFを更新
        if F < minF:
            minF = F

print(minF)

Submission status: Accepted

Solution code:
from sys import setrecursionlimit; setrecursionlimit(10**9)
N = int(input())

def factorize(n):
    # NOTE: if n == 1, return []
    if n < 1:
        raise Exception('Invalid input: n = {}'.format(n))
    i = 2
    ret = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            ret.append(i)
        i += 1
    if n > 1:
        ret.append(n)
    return ret

A = factorize(N)
l = len(A)

def res(i, B, C):
    if i >= l:
        val = 1
        for b in B:
            val *= b
        C.append(max(len(str(val)), len(str(N//val))))
        return None
    B.append(A[i])
    res(i+1, B, C)
    B.pop()
    res(i+1, B, C)
    return C

if N == 1:
    print(1)
else:
    C = res(0, [], [])
    print(min(C))

Submission status: Accepted

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

Submission status: Accepted

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

div = []
for i in range(1, int(math.sqrt(N))+1):
    if N % i == 0:
        div.append((i, N//i))
ans = 30
for elem in div:
    _, a = elem
    res = len(str(a))
    ans = min(ans, res)
print(ans)

Submission status: Accepted

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

div = []
for i in range(1, int(math.sqrt(N))+1):
    if N % i == 0:
        div.append((i, N//i))
ans = 30
for elem in div:
    _, a = elem
    cnt = 0
    while a > 0:
        a //= 10
        cnt += 1
    ans = min(ans, cnt)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

a = 0
ans = len(str(n))

while a*a <= n:
    a += 1
    if n%a != 0:
        continue
    b = int(n/a)
    cur = max(len(str(a)), len(str(b)))
    ans = min(ans, cur)

print(ans)

Submission status: Accepted

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

dig = float('inf')
for a in range(1, int(math.sqrt(n)) + 1):
    if n % a:
        continue
    b = n // a
    tmp = max(int(math.log10(a)), int(math.log10(b))) + 1
    if tmp < dig:
        dig = tmp

print(dig)

Submission status: Accepted

Solution code:
N = int(input())

root_N = pow(N,1/2)

ans = 1000
for i in range(int(root_N)+1):
	A = i+1
	if N%A == 0:
		B = N//A
		ans_l = max(len(str(A)), len(str(B)))
		ans = min(ans,ans_l)
print(ans)

Submission status: Accepted

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

def main():
    n = int(input())
    a = largest_nonlarger_dividor(n)
    b = n // a
    print(len(str(b)))

def largest_nonlarger_dividor(n):
    assert n > 0
    res = 1
    for i in range(2, int(n ** 0.5) + 10):
        if i ** 2 > n:
            break
        if n % i == 0:
            res = i
    return res

main()

Submission status: Accepted

Solution code:
# coding:utf-8

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

Submission status: Accepted

Solution code:
from math import sqrt

N = (int)(input())

sqrt_N = int(sqrt(N))


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


for i in reversed(range(sqrt_N+1)):
    if N % i == 0:
        print(F(i, N//i))
        exit()

Submission status: Accepted

Solution code:
# _*_ coding:utf-8 _*_
#  Atcoder_Beginning_Contest057-C
#  TODO https://atcoder.jp/contests/abc057/tasks/abc057_c
import math,sys

def F(A,B):
	strA = str(A)
	strB = str(B)
	return len(strB) if len(strA) <= len(strB) else  len(strA)


def solveProblem(givenNumber):
	maxTimes = int(math.sqrt(givenNumber))
	maxInteger = sys.maxsize
	for x1 in range(1,maxTimes+1,+1):
		# TODO 余りと商をdivmodで求める。もし余りが0であれば上の関数Fで求める。最小値を出す。
		x2 , modX1 = divmod(givenNumber,x1)
		if modX1 == 0:
			x2int = int(x2)
			maxLength=F(x1,x2int)
			maxInteger = maxLength if maxLength <= maxInteger else maxInteger
	answer = maxInteger
	return answer


if __name__ == '__main__':
	N = int(input().strip())
	solution = solveProblem(N)
	print("{}".format(solution))

Submission status: Accepted

Solution code:
import math
b = input()
a =int(b)
m = len(b)
for i in reversed(range(1,int(math.sqrt(a))+1)):
    if a/i == int(a/i):
        m = max(len(str(a//i)),len(str(i)))
        break
print(m)

Submission status: Accepted

Solution code:
import math
N = int(input())
f_min = int(math.log10(N)+1)
for i in range(1,int(math.sqrt(N))+2):
	if N%i == 0:
		f = max(int(math.log10(i)+1),int(math.log10(N//i)+1))
		
		if f < f_min:
			f_min = f
print(f_min)

Submission status: Accepted

Solution code:
# ABC 057
import math
def getInt(): return int(input())
def db(x): 
    global debug
    if debug: print(x)
debug = False
N = getInt()
m = int(math.sqrt(N))
for i in range(m,0,-1):
    db(i)
    if N%i==0: 
        print(int(math.log10(N//i))+1)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
c=11
for i in range(1,int(n**0.5)+2):
    if n%i==0:
        c=min(c,len(str(n//i)))
print(c)

Submission status: Accepted

Solution code:
def ketasu(N):
    count=1
    while N>=10:
        N//=10
        count+=1
    return count
N=int(input())
keta=10**10
for i in range(1,int(N**.5)+1):
    if N%i==0:
        keta=min(keta,max(ketasu(i),ketasu(N//i)))
print(keta)

Submission status: Accepted

Solution code:
import math
n = int(input())
rootn = int(math.sqrt(n))
ct = 0
for i in reversed(range(1,rootn+1)):
  if n%i == 0:
    tmp = n//i
    while tmp//10 != 0:
     ct += 1  
     tmp = tmp//10   
    break
print(ct+1)

Submission status: Accepted

Solution code:
import math


def divisor(num):
    if num < 0:
        return 0
    elif num == 1:
        return [1, ]
    else:
        divisor_list = [1, ]
        for i in range(2, int(math.sqrt(num) + 1)):
            if num % i == 0:
                divisor_list.append(i)
        return divisor_list


n = int(input())
divisor_list = divisor(n)
minA = divisor_list[-1]
print(len(str(n//minA)))

Submission status: Accepted

Solution code:
import math
N = int(input())
def func(a,b):
    return max(len(str(a)),len(str(b)))
ans = len(str(N))
for i in range(2,math.floor(pow(N,1/2)) + 1):
    if N % i == 0:
        div1 = i
        div2 = N // i
        if func(div1,div2) < ans:
            ans = func(div1,div2)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
rev = list(range(int(n**(1/2))+1))
rev = sorted(rev, reverse=True)
factor = 0
for i in rev:
    if n%i==0:
        factor=i
        break

def order(n):
    count = 0
    while n>0:
        n= n//10
        count += 1
    return count 

res = order(n//factor)
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
from math import sqrt
def f(a, b):
    c = max(a, b)
    ret = 0
    while(c != 0):
        c //= 10
        ret += 1
    return ret

N = int(input())
cand = []
for i in range(1, int(sqrt(N) + 2)):
    if N % i != 0:
        continue
    cand.append(f(i, N // i))
print(min(cand))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import sys


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


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


N = ii()
m = float("inf")
for n in range(1, int(N ** (1 / 2)) + 1):
    if N % n == 0:
        m = min(m, f(n, N // n))
print(m)

Submission status: Accepted

Solution code:
import math
N = int(input())
min = N
for i in range(1,int(N**0.5)+1):
    if N%i == 0 and min > max(math.log10(i), math.log10(N//i)):
        min = max(math.floor(math.log10(i))+1,math.floor(math.log10(N//i))+1)
print(min)

Submission status: Accepted

Solution code:
N = int(input())
ans = len(str(N))
for i in range(1,N):
    if i*i > N:
        break
    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 pow


N = int(input())
ans = len(str(10**10))

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

Submission status: Accepted

Solution code:
def abc057_c():
    from itertools import combinations

    def prime_decomposition(num):
        i = 2
        table = []
        while i * i <= num:
            while num % i == 0:
                num /= i
                table.append(i)
            i += 1
        if num > 1:
            table.append(int(num))
        return table

    n = int(input())
    primes = prime_decomposition(n)
    a = 1
    b = n

    for i in range(len(primes) // 2 + 1):
        comb = set(combinations(primes, i))
        for seq in comb:
            tmp_a = 1
            for v in seq:
                tmp_a *= v
            tmp_b = n // tmp_a
            if max(tmp_a, tmp_b) < max(a, b):
                a = tmp_a
                b = tmp_b

    ans = max(len(str(a)), len(str(b)))
    print(ans)


abc057_c()

Submission status: Accepted

Solution code:
import math

n = int(input())


ans = 10000000

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

    b = n //a
    
    ka = len(str(a))
    kb = len(str(b))

    if max(ka, kb) < ans:
        ans = max(ka, kb)


print(ans)

Submission status: Accepted

Solution code:
import math


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


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

Submission status: Accepted

Solution code:
import math
n = int(input())
a = math.floor(n**0.5)
while(a>1):
	if n%a == 0:
		break
	a -= 1
print(max(len(str(a)), len(str(n//a))))

Submission status: Accepted

Solution code:
import math
N = int(input())
m = int(math.sqrt(N))
a = 0
ans = 0
count = 1

for i in range(1, m+1):
    if N % i == 0:
        a = i

a = max(a, (N//a))

count = int(math.log10(a) + 1)
    
print(count)

Submission status: Accepted

Solution code:
import math
N = int(input())
m = int(math.sqrt(N))
a = 0
ans = 0
count = 1

for i in range(1, m+1):
    if N % i == 0:
        a = i

a = max(a, (N//a))

while True:
    if a >= 10:
        count += 1
        a = a// 10
    else:
        break
    
print(count)

Submission status: Accepted

Solution code:
from math import ceil, sqrt


def main():
    n = int(input())
    f_min = 30
    for a in range(1, ceil(sqrt(n)) + 1):
        if n % a != 0:
            continue
        b = n // a
        f_min = min(f_min, max(len(str(a)), len(str(b))))
    print(f_min)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 10**9+7
for A in range(1,N+1) :
    if A > N/A :
        break
    if N % A == 0 :
        B = N//A
        if ans > len(str(B)) :
            ans = len(str(B))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
digit_min = len(str(N))
for i in range(2, N):
  if (N % i == 0):
    digit = len(str(N // i))
    if (digit_min > digit):
      digit_min = digit
  if (i * i > N):
    break
print(digit_min)

Submission status: Accepted

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

p = []
for i in range(1, int(math.sqrt(n+1))+1):
    if n % i == 0:
        p.append(i)

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

print(ans)

Submission status: Accepted

Solution code:
import math

def alldiv(x):
    div = [[1,x]]
    for i in range(2,math.floor(math.sqrt(x))+1):
        if x % i == 0:
            div.append([i, x//i])
    return div


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


N = int(input())
div = alldiv(N)
#print(div)
F = [max(digit(i[0]),digit(i[1])) for i in div]
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(max(len(str(i)),len(str(N//i))))
print(min(a))

Submission status: Accepted

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

from math import sqrt

if __name__ == '__main__':
    n = int(input())
    f = 10**10
    for i in range(1, int(sqrt(n))+1):
        a = i
        b = n//a

        if a*b == n:
            f = min(max(len(str(a)), len(str(b))), f)

    print(f)

Submission status: Accepted

Solution code:
import math
n = int(input())
m = math.sqrt(n)
p = 0
q = 0
for i in range(int(m), 0, -1):
    if n % i == 0:
        p = str(i)
        q = str(int(n / i))
        break
print(max(len(p), len(q)))

Submission status: Accepted

Solution code:
import math

def ketaOk(a, N):#can divided by a+1 digits number
    for i in range(10 ** (a + 1) - 1, 10 ** a - 1, -1):
        if N % i == 0:
            M = max(i, N/i)
            return (math.floor(math.log10(M)) + 1)
        else:
            pass
    else:
        return 0

N = int(input())
a = math.floor(math.log10(N ** 0.5))

while a+1:
    ans = ketaOk(a, N)
    if ans:
        print(ans)
        break
    else:
        a = a - 1

Submission status: Accepted

Solution code:
N = int(input())
A = 1
X = int(N**(1/2))+1
for i in range(X, 1, -1):
    if N % i == 0:
        A = i
        break
print(len(str(N//A)))

Submission status: Accepted

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

if n==1:
    print(1)
    exit()
primes = []
x = 2
while x*x<=n:
    if n%x==0:
        primes.append(x)
        primes.append(n//x)
    x += 1

# print(primes)

def digit(x):
    return math.ceil(math.log10(x)) + (1 if x%10==0 else 0)

res = digit(n)
for i in range(len(primes)):
    a = primes[i]
    b = n//a
    t = max(digit(a), digit(b))
    # print(a,b,t)
    res = min(res, t)

print(res)

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

Solution code:
# 入力 : 自然数     ex) 12
# 出力 : 約数リスト ex) [(2,2),(3,1)]
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base ** exponent
    return a

n = int(input())
if n == 1:
    print(1)
    exit()
fct = factorize(n)
maxDigit = n
for div in divisorize(fct):
    outNum = num(div)
    nonOutNum = int(n/outNum)
    digitOut = 0
    digitNonOut = 0
    while outNum > 0:
        digitOut += 1
        outNum = int(outNum / 10)
    while nonOutNum > 0:
        digitNonOut += 1
        nonOutNum = int(nonOutNum / 10)
    if max(digitOut, digitNonOut) < maxDigit:
        maxDigit = max(digitOut, digitNonOut)
print(maxDigit)

Submission status: Accepted

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

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:
import math
N=int(input())
mid=int(math.sqrt(N))
flg=0
for i in range(mid,10**5+1):
    if N%i == 0:
        flg=1
        break
if flg==0:
    for i in range(mid,0,-1):
        if N%i == 0:
            break
dekaiyo=max(N/i,i)
count=1
while dekaiyo>=10:
    dekaiyo/=10
    count+=1
print(str(count))

Submission status: Accepted

Solution code:
import math

n=int(input())
for i in range(round(math.sqrt(n))+1,0,-1):
    if n%i==0:
        a=max(i,n//i)
        break
n=0
while a>=10:
    a=a//10
    n+=1
print(n+1)

Submission status: Accepted

Solution code:
import math

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

if n % m == 0:
    print(int(math.log10(m) + 1))

else:
    for i in range(1, m)[::-1]:
        if n % (i) == 0:
            print(int(math.log10(n / i) + 1))
            break

Submission status: Accepted

Solution code:
def f(a,b):
    c=max(a,b)
    i=0
    while c>=10**i:
        i +=1
    return i
n=int(input())
for i in range(int(n**(0.5)),0,-1):
    if n%i == 0:
        j=n//i
        break
print(f(j,i))

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-


"""
https://beta.atcoder.jp/contests/abc057/tasks/abc57_1
"""

import sys
import math
from inspect import currentframe

def debug(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args), file=sys.stderr)

N = int(input())

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


print(min([F(A, N // A) for A in range(1, int(math.sqrt(N)) + 1) if N % A == 0]))

Submission status: Accepted

Solution code:
import math


def is_prime(num):
    if (num < 2):
        return False
    elif(num == 2):
        return True
    elif (num % 2 == 0):
        return False
    sqrt_num = int(math.sqrt(num))
    for i in range(3, sqrt_num+1):
        if i % 2 == 0:
            continue
        if (num % i == 0):
            return False
    return True


N = int(input())
if is_prime(N):
    print(len(list(str(N))))
    exit()

min_num = 11
sqrt_num = int(math.sqrt(N))
for i in range(1, sqrt_num+1):
    if (N % i == 0):
        a = N//i
        b = i
        _min_num = max(len(list(str(a))), len(list(str(b))))
        min_num = min(min_num, _min_num)
print(min_num)

Submission status: Accepted

Solution code:
n = int(input())
mul_list = []
for i in range(1, n+1):
    if i <= n / i:
        if n % i == 0:
            mul = [i, n/i]
            mul_list.append(mul)
    else:
        break
length = 10000000000000
result = 0
for line in mul_list:
    dif = len(str(line[1]))-len(str(line[0]))
    if dif < length:
       result = len(str(int(line[1])))
print(result)

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

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
A=1
List=[]
while A<=N**(1/2):
  if N%A==0:
    List.append([A,int(N/A)])
  A+=1
Candidate=[]
for i in List:
  x=max(i)
  Candidate.append(len(str(x)))
print(min(Candidate))

Submission status: Accepted

Solution code:
import math

def calc(x):
  res = 0
  while x > 0:
    x //= 10
    res += 1
  return res

N = int(input())
ans = 20
for A in range(1, int(math.sqrt(N))+1):
  if N % A != 0:
    continue
  B = N // A
  ans = max(calc(A), calc(B))
print(ans)

Submission status: Accepted

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

A=N
B=1

sqrtN=int(math.sqrt(N))+1
#print(sqrtN)
for i in range(sqrtN,0,-1):
    if(N%i==0):
        A=i
        B=N//i
        break

#print("{} {}".format(A,B))
order=max(int(math.log10(A))+1,int(math.log10(B))+1)

print(order)

Submission status: Accepted

Solution code:
import math
N = int(input())
for A in range(int(math.sqrt(N)),0,-1):
    if N%A == 0:
        B = int(N/A)
        print(len(str(B)))
        break

Submission status: Accepted

Solution code:
import math
N, = map(int, raw_input().split())
mf = 100
for a in range(int(math.sqrt(N)),0,-1):
  if N%a==0:
    b = N//a
    print max(len(str(a)), len(str(b)))
    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import log10, sqrt
n = int(input())
def keta(n):
    res = 0
    while n >0 :
        res +=1
        n //= 10
    return res
ans = 1 << 22
for a in range(1, int(sqrt(n))+1):
    if n % a == 0:
        b = n // a
        ans = min(ans, max(keta(a) , keta(b)))
print(ans)

Submission status: Accepted

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