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:
# AtCoder
import math
N = int(input())
mi = float("inf")


def F(x, y):
    return max(len(str(x)), len(str(y)))


sq = math.floor(math.sqrt(N)+1)

for A in range(1, sq):
    if N % A == 0:
        B = N // A
        mi = min(F(A, B), mi)
print(mi)

Submission status: Accepted

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


def divisible_length(n):
    min_length = len(str(n))
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            min_length = min(min_length, max(len(str(i)), len(str(n // i))))
    return min_length


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:


#桁数を返す
#Nの桁数を返す (Nが0のときは0が返る)
#10進法のときは、10で割り続ければ桁数が返る
def calc_digits(n):
    res = 0
    while( int(n) ):
        res += 1
        n /= 10
    return res

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

for i in range(1,N+1):
    #調べるのはNの1/2乗まででよい
    if i * i > N:
        break

    if ( N % i == 0):
        #Nがiで割り切れたら約数は B と i
        B = N / i
        temp = max((calc_digits(i)),calc_digits(B))
        ans = min(ans,temp)

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
i=1
ans=10**10
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:
import sys
N=int(input())
ans=[]
if N==1:
    print(1)
    sys.exit()

for i in range(int(N**0.5),0,-1):
    if N%i==0:
        a=str(N//i)
        print(len(a))
        sys.exit()

Submission status: Accepted

Solution code:
def devisorlister(n):
    devisor_list=[]
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            devisor_list.append(i)
    if devisor_list==[]:
        devisor_list=[1]
    return max(devisor_list)

k=int(input())
m=devisorlister(k)
print(len(str(int(k/m))))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

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

def main():
    N = int(input())
    l = make_divisors(N)
    root = math.ceil(N ** 0.5)
    # print(N)
    # print(l)
    # print(root)
    for i in l:
        if i >= root:
            print(len(str(i)))
            break


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
def f(a,b):
    res = 0
    for i in [a,b]:
        res = max(len(str(i)),res)
    return res
ans = float("inf")
for a in range(1,N+1):
    if a*a>N:break
    if N%a==0:
        ans = min(ans, f(a,N//a))
print(ans)

Submission status: Accepted

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()

# n = a * b = b * aでなのでa<=bのaの方を求めてその時のbの桁数出力すれば間に合う。
# 上記のようにbの方から求めるとぎり間に合わない。

rtn = math.ceil(math.sqrt(n))
for i in reversed(range(1, rtn + 1)):
    if n % i == 0:
        b = n // i #求めるのはa(=i)ではなくbの方
        print(len(str(b)))
        exit()

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""


def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7
def main():
  n = int(input())
  i = 1
  while i*i <= n:
    if n % i == 0:
      ans = n//i
    i+=1
  print(len(str(ans)))
if __name__ == '__main__':
  main()

Submission status: Accepted

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

M = int(math.ceil(math.sqrt(N)))

for i in reversed(range(1, M+1)):
    if N % i == 0:
        print(len(list(str(N // i))))
        break

Submission status: Accepted

Solution code:
n = int(input())

ans = 9999999999

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:
import math
n = int(input())
divlist = []
ans = 100000
for i in range(1, int(math.sqrt(n)) + 1):
    if n % i == 0:
        divlist.append(i)
for i in divlist:
    fa = len(str(i))
    fb = len(str(int(n / i)))
    ans = min(ans, max(fa, fb))
print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
max=0
for a in range(1,int(n**0.5)+2):
    if n%a==0:
        max=a
print(int(math.log10(n/max)+1))

Submission status: Accepted

Solution code:
import math
N=int(input())
def F(a,b):
  return(max(len(str(a)),len(str(b))))
d=int(math.sqrt(N))
m=1000000007
for i in range(1,d+1):
  if N%i!=0: continue
  m=min(m,F(i,N//i))
print(m)

Submission status: Accepted

Solution code:
def f(x,y):
    count_x, count_y = 1, 1
    while x/10>=1:
        x = x//10
        count_x += 1
    while y/10>=1:
        y = y//10
        count_y += 1
    return max(count_x, count_y)

pf = []
m = int(input())

for i in range(1,int(m**0.5)+1):
    if m%i == 0:
        pf.append(i)

print(f(pf[-1], m/pf[-1]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

F = len(str(N))
for A in range(1, int(N**0.5)+1):
    if N%A != 0:
        continue
    B = N // A
    F = min(F, max([len(str(x)) for x in [A,B]]))

print(F)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

import math
n = int(readline())
m = int(math.sqrt(n))
l = []
for a in range(1, m + 1):
    if n % a == 0:
        b = n // a
        c = max(len(str(a)), len(str(b)))
        l.append(c)
print(min(l))

Submission status: Accepted

Solution code:
n = int(input())

e = []
i = 1
while i * i <= n:
    if n % i == 0:
        e.append([str(i),str(n//i)])
    i += 1

ans = 10**9
for i in range(len(e)):
    ans = min(max(len(e[i][1]),len(e[i][0])),ans)
print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
ab=[]
m=10000
for i in range(1,int(math.sqrt(n))+1):
  if n%i==0:
    ab.append([i,int(n/i)])
f=[]
for i in ab:
  a=len(str(i[0]))
  b=len(str(i[1]))
  if a>b:
    f.append(a)
  else:
    f.append(b)
    
for i in f:
  if m>i:
    m=i
print(m)

Submission status: Accepted

Solution code:
from math import sqrt

N = int(input())

def ans(n):
    a,b = 1,n
    for i in range(2,int(sqrt(n))+1):
        if n % i == 0:
            a,b = i,n//i
    return max(len(str(a)),len(str(b)))

print(ans(N))

Submission status: Accepted

Solution code:
def resolve():
    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: # 平方数の場合n**0.5を1つだけにしてる
                    divisors.append(n//i)

        # divisors.sort() # ソートしたけりゃして
        return divisors
    l=make_divisors(N)
    ls=len(l)
    l1=l[-1]
    try:
        l2=l[-2]
    except:
        pass

    if len(l)%2==0:
        print(max(len(str(l1)),len(str(l2))))
    else:
        print(len(str(l1)))
        

resolve()

Submission status: Accepted

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

N = int(input())

ans = 10 ** 9

for A in range(1, int(sqrt(N)) + 1):
    if N % A == 0:
        B = N // A
        str_A = str(A)
        str_B = str(B)
        ans = min(ans, max(len(str_A), len(str_B)))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

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

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

ans = []
for i in arr:
    ans.append(max(len(str(i)),len(str(n // i))))
print(min(ans))

Submission status: Accepted

Solution code:
import math
n = int(input())
a = int(math.modf(n**0.5)[1])
aa = []
for i in range(1, a+1):
    if n%i==0:
        aa.append([len(str(i)), len(str(n//i))])
print(aa[-1][1])

Submission status: Accepted

Solution code:
n=int(input())

n2=int(n**(0.5))

s=[]
for i in range(1,n2+1):
    if n%i==0:
        s.append(n//i)
#        print(i,n//i)
b=s[-1]
print(len(str(b)))

Submission status: Accepted

Solution code:
# ABC 057 C - Digits in Multiplication
# 2020/04/07　20:6-
n = int(input())

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

ans = 10**12
for i in range(1, int(n**(1/2))+1):
    j = n / i
    if j%1 == 0:
        j = n // i
        if ans > F(i, j):
            ans = F(i, j)
            
print(ans)

Submission status: Accepted

Solution code:
import numpy


def F(A, B):
    count = 0
    while A > 0 or B > 0:
        A //= 10
        B //= 10
        count += 1
    return count


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

Submission status: Accepted

Solution code:
import math
N=int(input())
a=int(math.sqrt(N))+1

for i in range(a):
  if(N%(a-i)==0):
    x=N//(a-i)
    count=0
    while(x>=1):
      x=x/10
      count+=1
    break
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

lis = []
for i in range(1, int(n**0.5)+1):
	if n%i==0:
		lis.append(F(i,n//i))

print(min(lis))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


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(readline())
print(len(str(make_divisors(n)[-1])))

Submission status: Accepted

Solution code:
def F(A,B):
    A_len=len(str(A))
    B_len=len(str(B))
    return max(A_len,B_len)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# C - Digits in Multiplication
# モジュールのインポート
import math

# 標準入力の取得
N = int(input())

# 求解処理
# F(A, B)を定義
def F(A:int, B:int) -> int:
    digits_A = len(str(A))
    digits_B = len(str(B))
    return max(digits_A, digits_B)

# 全探索を行い、F(A, B)の最小値を求める
# a <= bとして、sqrt(N)まで探索を行うことで、時間を節約する
result = len(str(N)) # 初期値として、Nの桁数を入力
for a in range(1, int(math.sqrt(N))+1):
    # bが整数でない場合、何もしない
    if N % a != 0:
        continue

    # bが整数である場合、a, bのうち桁数が大きい方を求める
    b = int(N / a)
    result = min(result, F(a, b))

# 結果出力
print(result)

Submission status: Accepted

Solution code:
n = int(input())

ans = 10

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

i = 1
while i * i <= n:
	if n%i == 0:
		ans = min(ans,F(i,n//i))	
		#print(i,n//i)
	i += 1
print(ans)

Submission status: Accepted

Solution code:
from math import sqrt
n=int(input())
for i in range(int(sqrt(n)),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=float('inf')
for i in range(1,int(n**0.5)+1):
    if n%i == 0:
        x=len(str(i))
        y=len(str(n//i))
        z=max(x,y)
        ans=min(z,ans)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from itertools import count


INF = sys.maxsize
N = int(input())
answer = INF

for i in count(1):
  # √N 見れば十分
  if i * i > N:
    break
  q, r = divmod(N, i)
  # 割り切れない場合は不適
  if r != 0:
    continue
  answer = min(
    answer, max(
      len(str(q)),
      len(str(N // q))
    )
  )

print(answer)

Submission status: Accepted

Solution code:
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def No(): print('No')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()

def enum_divisors(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if N % i == 0:
            divisors.add(i)
            divisors.add(N//i)
    return sorted(divisors)

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

divisors = enum_divisors(N)
ans = 10**10
for d in divisors:
    ans = min(ans, F(d, N//d))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
N=int(input())
mi=float("inf")
nu=0
for i in range(int(math.sqrt(N))):
    a=i+1
    b=N/a
    if (b.is_integer())==True:
        nu=max(len(str(int(a))),len(str(int(b))))
        mi=min(mi,nu)
print(mi)

Submission status: Accepted

Solution code:
N = int(input())

ans = int(1e5)

for a in range(1, int(N ** 0.5) + 1):
    if N % a == 0:
        b = len(str(N // a))
        ans = min(b, ans)
print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())
N_s = math.floor(math.sqrt(N))

for i in reversed(range(1, N_s+1)):
    if N % i == 0:
        print(len(list(str(N // i))))
        break

Submission status: Accepted

Solution code:
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
#from scipy.misc import comb

N = int(input())

ans = 100
A = 1
while A * A <= N:
    if N % A == 0:
        B = N // A
        ans = min(ans, len(str(B)))
    A += 1

print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())

tmp = math.floor(math.sqrt(N))
while N % tmp:
    tmp -= 1
print(len(str(N // tmp)))

Submission status: Accepted

Solution code:
# coding: utf-8
import math

N = int(input())

sum = 0
ans = 0
for a in range(1, math.floor(math.sqrt(N)) + 1):
    b = N // a
    if N == a * b:
        sum = 0
        while not b == 0:
            b = b // 10
            sum += 1
        if ans > sum or ans == 0:
            ans = sum
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

halfn=int(2+n**0.5)

for i in range(1,halfn):
    if n%i==0:
        memo = i

ans = max(len(str(n//memo)), len(str(memo)))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 10
for i in range(1,int(N**0.5)+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: Accepted

Solution code:
N = int(input())
n = int(N**(1/2))

saisyo = float("inf")
for i in range(1, n+1):
    if N%i ==0:
        saisyo = min(saisyo, len(str(N//i)))

print(saisyo)

Submission status: Accepted

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

Solution code:
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


def divisors(n, sort=False):
    """
    nの約数をO(√n)で列挙する
    """
    d = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            d.append(i)
            if i != n // i:
                d.append(n//i)
    if sort:
        d.sort()
    return d


N = I()
d = divisors(N, sort=True)
ans = len(str(d[len(d) // 2]))
print(ans)

Submission status: Accepted

Solution code:
ans = 20
def divisor_length(n,ans):
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i != n // i:
                ans = min(ans,max(len(str(i)),len(str(n//i))))
            else:
                ans = min(ans,len(str(i)))
 
    return ans

n = int(input())
answer = divisor_length(n,ans)

print(answer)

Submission status: Accepted

Solution code:
n=int(input())

import math
for i in range(1,int(math.sqrt(n))+1):
    if n%i==0:
        ans=len(str(n//i))
print(ans)

Submission status: Accepted

Solution code:
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n = ni()

def digit(x):
    res = 1
    while x // 10 != 0:
        x //= 10
        res += 1
    return res

ans = digit(n)
i = 2
while i * i <= n:
    if n % i == 0:
        ans = min(ans, digit(n // i))
    i += 1

print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    ans = n
    for a in range(1,int(n**0.5) + 1):
        if n % a == 0:
            b = n // a
            ans = min(ans, func(a,b))
    print(ans)

def func(a,b):
    str_a = str(a)
    str_b = str(b)
    return max(len(str_a), len(str_b))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

N = int(input())

divisor=[]
for i in range(1, math.floor(math.sqrt(N))+1):
    if N % i == 0:
        divisor.append(i)
#print(divisor)

M=max(divisor)
left=len(str(M))
right=len(str(N//M))
print(max(left, right))

Submission status: Accepted

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

Submission status: Accepted

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

r = -int(-sqrt(n)//1)
tmp = 0
for i in range(1, r+1):
    tmp = i if (n % i == 0) else tmp

print(max(len(str(tmp)), len(str(n//tmp))))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

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


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    # sys.stdin = open("sample.txt")
    N = Scanner.int()
    div = Math.divisor(N)
    div.sort()
    if len(div) % 2 == 1:
        print(len(str(div[len(div) // 2])))
    else:
        a = div[len(div) // 2]
        b = div[len(div) // 2 - 1]
        print(max(len(str(a)), len(str(b))))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math

n = int(input())

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

ans = 10**10

if n == 1:
    print(1)
    exit()

for a in range(1,N+1):
    amari = n%a
    if amari == 0:
        b = int(n / a)
        f = max(len(str(a)),len(str(b)))
        ans = min(f,ans)

print(ans)

Submission status: Accepted

Solution code:
#57c
import math

N = int(input()) #10**10
#FはA,Bの大きい方に引っぱられる　∴A,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
    
divisors_list = make_divisors(N) #len(divisors_list)<=121 程度。総当たり出来る。

F_min = 11 #N<=10**10なので11桁が最大。

for divisors in divisors_list:
    A = divisors
    B = int(N/divisors)
    F = max(1+int(math.log10(A)),1+int(math.log10(B)))
    F_min = min(F_min,F)
    
print(F_min)

Submission status: Accepted

Solution code:
import math

N=int(input())
P= math.floor(N**0.5)

for A in range(P,0,-1):
  if N%A==0:
    B=N//A
    #print(A,B)
    break
    
def F(A,B):
  return max(len(str(A)),len(str(B)))

print(F(A,B))

Submission status: Accepted

Solution code:
N = int(input())

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

print(len(str(N//P)))

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
ans=float('inf')
n=int(input())
import math
sq=int(math.sqrt(n))
for i in range(1,sq+1):
    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())
for i in range(int(n**.5),0,-1):
  if n%i<1: print(len(str(n//i))); break

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = 10**10
for a in range(math.ceil(math.sqrt(n)), 0, -1):
    if n % a == 0:
        b = n//a
        # if ans > max(len(str(a)), len(str(b))):
        ans = max(len(str(a)), len(str(b)))
        break

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
l = []
for A in range(1, int(N ** 0.5) + 1):
    B = N // A
    if N == A * B:
        
        l.append(max(len(str(A)), len(str(B))))
        #print(A, B)
print(min(l))

Submission status: Accepted

Solution code:
n = int(input())

s = n**0.5 + 20
s = int(s)

while True:
    if n%s == 0:
        a = list(str(s))
        b = list(str(n//s))
        ans = max(len(a), len(b))
        print(ans)
        exit()
    else:
        s -= 1

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(str(i))
            if i != n // i:
                divisors.append(str(n//i))
    return divisors
group = make_divisors(N)
if len(group) % 2 == 1:
  print(len(str(int(N**0.5))))
else:
  print(max(len(group[len(group) - 2]), len(group[len(group) - 1])))

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

N = i_i()

ans = len(str(N))
arr = []
for i in range(1, int(N**0.5)+1):
    if N % i != 0:
        continue
    
    j = int(N / i)
    tmp = max(len(str(i)), len(str(j)))
    if ans > tmp:
        ans = tmp
    
print(ans)

Submission status: Accepted

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