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: Time Limit Exceeded

Solution code:
def main():
    # 入力
    n = int(input())

    min_l = 10

    for i in range(1, n+1):
        if n % i != 0:
            continue
        j = int(n / i)

        il = len(str(i))
        jl = len(str(j))
        f = max(il, jl)
        if f < min_l:
            min_l = f
        if il == jl or il > jl:
            break

    print(min_l)


main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
res = 10**10 + 1
for A in range(1, N + 1):
    if N % A == 0:
        B = N // A
        a = len(str(A))
        b = len(str(B))
        if a > b:
            num = a
        else:
            num = b
        if res > num:
            res = num
print(res)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
res = 10**10 + 1
for A in range(1, N + 1):
    for B in range(1, A + 1):
        total = A * B
        if total == N:
            a = len(str(A))
            b = len(str(B))
            if a > b:
                num = a
            else:
                num = b
            if res > num:
                res = num
print(res)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
N=int(input())
ans=[]
if N==1:
    print(1)
    sys.exit()
for i in range(int(N**0.5)-1,N+1):
    if N%i==0:
        a=str(i)
        print(len(a))
        sys.exit()

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
divi=[]
for i in range(1,n+1):
  if n % i ==0:
    divi.append(i)
di=reversed(divi)
div=[]
for d in di:
  div.append(d)
pair=list(zip(divi,div))
ab=[]
for i in pair:
  a=len(str(i[0]))
  b=len(str(i[1]))
  if a>=b:
    ab.append(a)
  else:
    ab.append(b)
print(min(ab))

Submission status: Time Limit Exceeded

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

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

if is_prime(n):
    print(len(str(n)))
    exit()

rtn = math.floor(math.sqrt(n))

for i in range(rtn,n+1):
    if n % i == 0:
        print(len(str(i)))
        exit()

Submission status: Time Limit Exceeded

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

rtn = math.floor(math.sqrt(n))

for i in range(rtn,n+1):
    if n % i == 0:
        print(len(str(i)))
        exit()

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
N = int(input())
for n in range(int(math.sqrt(N)),N+1):
  if N%n==0:
    print(max(int(math.log10(n)), int(math.log10(N//n)))+1)
    sys.exit()

Submission status: Time Limit Exceeded

Solution code:
import math

P=[]
n=int(input())
N=int(math.sqrt(n))

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
cont = []
res = 0
for A in range(1, N + 1):
    if N % A == 0:
        B = int(N / A)
        if len(str(A)) <= len(str(B)):
            res = len(str(B))
        elif len(str(A)) >= len(str(B)):
            res = len(str(A))
        cont.append(res)
    else:
        continue
print(min(cont))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

if N == 1:
    print(1)
    sys.exit(0)


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


P = prime_factorize(N)

ans = len(str(N))

for i in range(2 ** (len(P) - 1)):
    a = 1
    b = 1
    for j in range(len(P)):
        if (i >> j) & 1 == 1:
            a *= P[j]
        else:
            b *= P[j]

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

def prime_judge(n):
  if n == 2:
    return True
  if n < 2 or n % 2 == 0:
    return False
  for i in range(3, int(math.sqrt(n)) + 1, 2):
    if n % i == 0:
      return False
  return True

N=int(input())
if prime_judge(N):
  print(len(str(N)))
else:
  tmp=int(math.sqrt(N))
  while N%tmp!=0:
    tmp+=1
  tmp=max(tmp,N//tmp)
  print(len(str(tmp)))

Submission status: Time Limit Exceeded

Solution code:
import math
N=int(input())
tmp=int(math.sqrt(N))
while N%tmp!=0:
  tmp+=1
tmp=max(tmp,N//tmp)
print(len(str(tmp)))

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
ans = 10
for A in range(1, N+1):
  if N % A == 0:
    B = N//A
    F = max(len(str(A)), len(str(B)))
    if ans > F:
      ans = F 
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
N=int(input())
# rootを求める
root_n = int(math.sqrt(N))
up_n = root_n
up_ans = 0
keta = lambda x: len(str(x))
while up_n <= N:
  if N % up_n == 0:
    pair = int(N/up_n)
    # 桁数を求める
    up_ans = max(keta(pair), keta(up_n))
    break
  else:
    up_n+=1

print(up_ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
import math
rootN=math.sqrt(N)
if rootN==int(rootN):
    n=int(rootN)
else:
    for m in range(int(rootN)+1,N+1):
        if N%m==0:
            n=m
            break
print(len(str(n)))

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
from fractions import gcd
def main():
    N = int(input())
    ans = len(str(N))
    for i in range(1, N // 2 + 2):
        if N % i == 0:
            tmp = max(len(str(i)),  len(str(N // i)))
        if ans > tmp:
            ans = tmp
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# atcoder
import math

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

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

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

Submission status: Time Limit Exceeded

Solution code:
def choose_larger_digit(a, b):
    return max(number_of_digits(a), number_of_digits(b))


def number_of_digits(n):
    digit = 0
    while n>0:
        digit = digit + 1
        n = int(n/10)
    return digit


n = int(input())
min_digits_diff = float('inf')
for a in range(1, n+1):
    b = int(n / a)
    if n == a * b:
        min_digits_diff = min(min_digits_diff, choose_larger_digit(a, b))
print(min_digits_diff)

Submission status: Time Limit Exceeded

Solution code:

n = int(input())
ans = 10

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

#print(fun(125,80))


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

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


def main():
    N = int(input())
    for i in range(int(N ** 0.5), N + 1):
        if N % i == 0:
            print(len(str(i)))
            break


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import math

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

for i in range(a, n + 1):
    if n % i == 0:
        print(len(str(i)))
        exit()

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
from math import sqrt
m=int(sqrt(n))
for i in range(m,n+1):
  if n%i==0:
    print(len(str(i)))
    exit()

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
ans=len(str(n))
from math import floor,sqrt
s=floor(sqrt(n))
f=[]
for i in range(2,s+1):
    if n%i==0:
        while True:
            f.append(i)
            n//=i
            if n%i!=0:
                break
if n!=1:
    f.append(n)
l=len(f)
iter=2**l-1
for i in range(2**l):
    iter+=1
    liter=str(bin(iter))[3:]
    a,b=1,1
    for j in range(l):
        if liter[j]=="0":
            a*=f[j]
        else:
            b*=f[j]
    t=max(len(str(a)),len(str(b)))
    if t<ans:
        ans=t
print(ans)

Submission status: Time Limit Exceeded

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())
answer = float('inf')
max = 0
len_div = len(make_divisors(N))

if len_div % 2 == 0:
    for i in range(len_div // 2):
        A_len = len(str(make_divisors(N)[i]))
        B_len = len(str(make_divisors(N)[len_div - i - 1]))
        if A_len <= B_len:
            max = B_len
        else:
            max = A_len
        # print(A_len, B_len, max)
else:
    for i in range(len_div // 2 + 1):
        A_len = len(str(make_divisors(N)[i]))
        B_len = len(str(make_divisors(N)[len_div - i - 1]))
        # print(A_len, B_len)
        if A_len <= B_len:
            max = B_len
        else:
            max = A_len
        # print(A_len, B_len, max)

print(max)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
T = 100
for i in range(1,N+1):
    if N%i ==0:
        A = i
        B = N/i
        Q = len(str(max(A, B)))
        T = min(T,Q)
print(T)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

ans = 100
for i in range(1, N+1):
  if N % i == 0:
    ans = min(ans, F(i, N//i))

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())
i = int(math.sqrt(n))
while i<=n:
  if n%i==0:
    print(len(str(i)))
    break
  i+=1

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())
i = int(math.sqrt(n))
while i<=n:
  if n%i==0:
    print(len(str(i)))
    break
  i+=1

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# ABC057 C - Digits in Multiplication
from itertools import combinations
def factorize(n):
    retlist = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
                retlist.append(i)
    if temp!=1:
        retlist.append(temp)

    if retlist==[]:
        retlist.append(n)

    return retlist

N = int(input())

ans = 10000000
L = []
L = factorize(N)
# print(L)

for i in range(1,len(L)+1):
    C = []
    C = list(combinations(L,i))
    # print(C)
    for c in C:
        a,b = 1,0
        for j in range(len(c)):
            a *= c[j]
        b = N//a
        a = str(a)
        b = str(b)
        # print('a:',a,'b:',b)
        ans = min(ans,max(len(a),len(b)))

print(ans)

Submission status: Time Limit Exceeded

Solution code:
def F(a,b):
  m = max(a,b)
  count=1
  while m//10!=0:
    count+=1
    m//=10
  return count

N = int(input())
tmp=F(1,N)
for i in range(1,N//2+1):
  if N%i==0:
    if tmp>F(i,N//i):
      tmp = F(i,N//i)
print(tmp)

Submission status: Time Limit Exceeded

Solution code:
# C - Digits in Multiplication
N = int(input())

A = int(N**0.5)
ans = 1
for i in range(A,N):
    if N % i == 0:
        ans = len(str(i))
        break
    else:
        ans = len(str(i))

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
def isPrime(n):
  if n < 2:
    return False
  i = 2
  while i*i <= n:
    if n%i == 0:
      return False
    i += 1
  return True
if isPrime(N):
  print(len(str(N)))
else:
  ans = float("inf")
  for i in range(1,N+1):
    if N % i == 0:
      if i >= N // i:
        ans = min(ans,len(str(i)))
      else:
        ans = min(ans,len(str(N // i)))
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
n = int(input())
ans = int(math.sqrt(n))
while True:
  if n % ans == 0:
    break
  else:
    ans += 1
print(len(str(ans)))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

import math


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def solve(N: int):
    from functools import reduce
    from operator import mul

    a = prime_factorize(N)
    a.sort(reverse=True)
    if(len(a)==1):
        print(len(str(a[0])))
        exit()

    # bit all search
    ans = 100000000
    for i in range(1<<len(a)):
        x = 1
        y = 1
        for j in range(len(a)):
            if((i >> j)&1):
                x *= a[j]
            else:
                y *= a[j]

        ans = min(ans, max(len(str(x)), len(str(y))))


    print(ans)
    


    return


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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
def prime_factor(n):
    factors = []
    for i in range(2,int(n**0.5)+1):
        while n%i==0:
            factors.append(i)
            n = n//i
    if n!=1:
        factors.append(n)
    return factors

N = int(input())
li = prime_factor(N)
a = len(li)
ans = 10**9
for i in range(2**a):
    tmp1 = tmp2 = 1
    for j in range(a):
        if ((i>>j) & 1):
            tmp1 *= li[j]
        else:
            tmp2 *= li[j]
    tmp3 = max(len(str(tmp1)),len(str(tmp2)))
    if ans>tmp3:
        ans = tmp3
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def prime_factor(n):
    factors = []
    for i in range(2,int(n**0.5)+1):
        while n%i==0:
            factors.append(i)
            n = n//i
    if n!=1:
        factors.append(n)
    return factors

N = int(input())
li = prime_factor(N)
a = len(li)
ans = []
for i in range(2**a):
    tmp1 = 1
    tmp2 = 1
    for j in range(a):
        if ((i >> j) & 1):
            tmp1 *= li[j]
        else:
            tmp2 *= li[j]
    ans.append(max(len(str(tmp1)),len(str(tmp2))))
print(min(ans))

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())

ans = 1e+99
for a in range(1,N+1):
  if N % a == 0:
    b = N // a
  else:
    continue
  d_a = 1 + int(np.log10(a))
  d_b = 1 + int(np.log10(b))
  F = max(d_a, d_b)
  if F < ans:
    ans = F
print(ans)

Submission status: Time Limit Exceeded

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

N = int(input())
ans = float('inf')
for a in range(1,N+1):
  if N % a != 0: continue
  ans = min(ans,F(a,int(N/a)))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

ans=len(str(n))
for i in range(1,n+1):
  if n%i==0:
    if n//i<i:
      break
    else:
      ans=min(ans,max(len(str(i)),len(str(n//i))))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# Factoring by trial split
def getPrimeList(n):
  l=[]
  t=int(math.sqrt(n))+1
  
  for a in range(2,t):
    while n%a==0:
      n//=a
      l.append(a)
  
  if n!=1:
    l.append(n)
  
  return l

def main():
  n=I()
  l=getPrimeList(n)

  mn=len(str(n))
  for i in range(2**len(l)):
    a=n
    b=1
    for j in range(len(l)):
      if ((i>>j)&1):
        a//=l[j]
        b*=l[j]
    mn=min(mn,max(len(str(a)),len(str(b))))

  return mn

# main()
print(main())

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

min_x = len(list(str(N)))

for i in range(1, N // 2 + 1):
  if N % i == 0:
    min_x = min(min_x, f(str(i), str(N // i)))
    if len(str(i)) >= len(str(N // i)):
      break
print(min_x)

Submission status: Time Limit Exceeded

Solution code:
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

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

n = int(input())
prime_factor = factorize(n)
min_f = 10**10

for i in range(2 ** (len(prime_factor))):
    bin_i = format(i, '0' + str(len(prime_factor)) + 'b')
    flags = list(map(int, list(bin_i)))
    positive, negative = 1, 1
    for j, p in enumerate(prime_factor):
        if flags[j] != 0: 
            positive *= flags[j] * p
    for j, p in enumerate(prime_factor):
        if (1 - flags[j]) != 0: 
            negative *= (1 - flags[j]) * p
    result = f(positive, negative)
    if result < min_f:
        min_f = result
    else:
        pass
print(min_f)

Submission status: Time Limit Exceeded

Solution code:
import math

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

Submission status: Time Limit Exceeded

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, math.ceil(n / 2) + 1):
    if n % a == 0:
        ans = compare_digits(a, int(n / a))
        if ans < ans_min:
           ans_min = ans

print(ans_min)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import math

N=int(input())

def digits(N):
    m = int(math.sqrt(N))
    while True:
        if int(N%m)==0:
            return(len(str(m)))
        else:
            m += 1
print(digits(N))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

for i in range(n):
    if n%(root+i)==0:
        print(len(str(root+i)))
        break

Submission status: Time Limit Exceeded

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, N + 1):
	if not N % i:
		j = N // i
		if j < i:
			break
		min_dig = min(min_dig, func(i, j))

print(min_dig)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
v = round(N ** 0.5)
while N % v != 0:
    v += 1
print(len(str(v)))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def F(a, b):
    count = 0
    c = max(a, b)
    while c > 9:
        c = c / 10
        count += 1
    return count+1

N = int(input())
minimum = 11
for num in range(1,int(N/100)+101):
    if N % num == 0:
        minimum = min(minimum, F(num, N/num))
print(minimum)

Submission status: Time Limit Exceeded

Solution code:
def F(a, b):
    count = 0
    c = max(a, b)
    while c > 9:
        c = c / 10
        count += 1
    return count+1

N = int(input())
minimum = 11
for num in range(1,int(N/4)+5):
    if N % num == 0:
        minimum = min(minimum, F(num, N/num))
print(minimum)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = N
pred = N
for i in range(1, N//2):
    d = 0
    if N % i == 0:
        d = max(len(str(i)), len(str(N//i)))
        ans = min(ans, d)
        if d > pred:
            break
        pred = d
print(ans)

Submission status: Time Limit Exceeded

Solution code:

import math

def read_input():
    n = int(input())
    return n


def submit():
    n = read_input()

    factor_cand = int(math.ceil(math.sqrt(n)))

    while n % factor_cand:
        factor_cand += 1

    a = int(n / factor_cand)
    b = int(factor_cand)

    al = len([c for c in str(a)])
    bl = len([c for c in str(b)])

    print(max(al, bl))



if __name__ == '__main__':
    submit()

Submission status: Time Limit Exceeded

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

N = int(input())

check = 100
for i in range(1, 1+N):
    if N % i != 0:
        continue
    if N // i < i:
        break
    j = N // i
    f = max(digit(i), digit(j))
    check = min(check, f)

print(check)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
if n == 1:
    print(1)
    exit()
a = 1
b = n
for i in range(1, 10**10):
    if n % i == 0:
        if i > n // i:
            print(min(len(str(i)), len(str(b))))
            exit()
        a = i
        b = n // i

Submission status: Time Limit Exceeded

Solution code:
import math

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

N = int(input())
min = F(1,N)
rt = int(math.sqrt(N))
for i in range(rt,N+1):
    if N % i != 0:
        continue
    f = F(i,int(N/i))
    if f < min:
        min = f
        break
print(min)

Submission status: Time Limit Exceeded

Solution code:
import math

num = int(input())
num_sqrt = int(math.sqrt(num))

A = num_sqrt
while num % A != 0:
    A += 1
B = int(num / A)
A, B = str(A), str(B)
ans = max(len(A), len(B))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

min_l = len(str(N))
o_min_l = min_l

for i in range(1, N):
    if N % i == 0:
        j = int(N / i)
        min_l = min(min_l, max(len(str(i)), len(str(j))))
print(min_l)

Submission status: Time Limit Exceeded

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

dvs = []
pair = []
digit = []

for i in range(1, N+1):
  if N % i == 0:
    dvs.append(i)
    
for i in range(len(dvs)//2+1):
  pair.append([dvs[i], dvs[-(i+1)]])

for i in range(len(pair)):
  digitA = int(math.log10(pair[i][0])) + 1
  digitB = int(math.log10(pair[i][1])) + 1
  digit.append(max(digitA, digitB))

ans = min(digit)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def gk(n):
    ans = 0
    while n:
        ans += 1
        n//=10
    return ans

if int(N**(1/2)) ** 2 == N:
    print( gk( int(N**(1/2)) ))
else:
    for i in range( int(N**(1/2)), N+1):
        if N % i == 0:
            print( gk(i) )
            exit(0)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
l = [ i for i in range(1,n+1) if i*i <= n]
for a in l[::-1]:
    if n % a == 0:
        print(max(len(str(a)),len(str(n//a))))
        break

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

res = prime_factor(N)

import itertools

#n桁のm値のbitを生成
def bit(n, m):
    bit_list = list(itertools.product([i for i in range(m)], repeat=n))
    return bit_list

bit_list = bit(len(res), 2)
result = 10 ** 7
for b in bit_list:
    tmp1 = 1
    tmp2 = 1
    for i in range(len(res)):
        if b[i] == 0:
            tmp1 *= res[i]
        else:
            tmp2 *= res[i]
            
    result = min(result, max(len(str(tmp1)), len(str(tmp2))))
    
print(result)

Submission status: Time Limit Exceeded

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