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

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

def solve(n):
    ans = 100

    for i in range(1, int(math.sqrt(n))+1):
        if n % i == 0:
            a = n / i
            b = n / a
            k = max(get_degit(a), get_degit(b))
            if k < ans:
                ans = k

    return ans

def main():
    n = int(sys.stdin.readline())
    ans = solve(n)

    print(ans)

    return 0

if __name__ == '__main__':
    sys.exit(main())

Submission status: Accepted

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

def F(a,b):
    return max(math.floor(math.log10(a)), math.floor(math.log10(b))) + 1

res = 0

for m in range(1, M+1):
    if N % m == 0:
        res = F(m, N//m)

print(res)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import math

N = input()

MinDigit = 10000000001
for i in range(int(math.sqrt(N))+1):
    quotient = 1.0*N/(i+1)
    if(quotient.is_integer() == True):
        #print(i+1,quotient)
        #print(len(str(i+1)),len(str(int(quotient))))
        #print(max(len(str(i+1)),len(str(int(quotient)))))
        if(MinDigit>max(len(str(i+1)),len(str(int(quotient))))):
            MinDigit = max(len(str(i+1)),len(str(int(quotient))))

print(MinDigit)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import math
n = int(input())
res = []
for i in range(int(math.sqrt(n))):
    if n%(i+1) == 0:
        res.append(i+1)
ans = int(math.log10(n/res[-1]) + 1)
print(ans)

Submission status: Accepted

Solution code:
import math

def keta(a):
    count=1
    while a>=10:
        a/=10
        count+=1
    return count


N=int(input())
mi=10
for i in range(1,int(N/math.sqrt(N)+1)):
    if N%i==0:
        j=int(N/i)
        if mi>max(keta(i),keta(j)):
            mi=max(keta(i),keta(j))

print(mi)

Submission status: Accepted

Solution code:
import math

def keta(a):
    count=1
    while a>=10:
        a/=10
        count+=1
    return count


N=int(input())
mi=10
for i in range(1,int(N/math.sqrt(N)+1)):
    if N%i==0:
        j=int(N/i)
        if mi>max(keta(i),keta(j)):
            mi=max(keta(i),keta(j))

print(mi)

Submission status: Accepted

Solution code:
import math

n = int(input())

a = 1
for x in range(1, math.floor(math.sqrt(n)) + 1):
  if n % x == 0:
    a = x

b = n / a
res = 1
for i in reversed(range(11)):
  if b >= 10 ** i:
    res = i + 1
    break

print(res)

Submission status: Accepted

Solution code:
import numpy as np


def numOfDigit(n):
    return int(np.log10(n) + 1)


N = int(input())
M = numOfDigit(N)

for i in range(int(np.sqrt(N)) + 1):
    if N % (i + 1) != 0:
        continue
    N1 = N / (i + 1)
    N2 = i + 1
    M = min(M, numOfDigit(max(N1, N2)))

print(M)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

def fact(n):
    i = 2
    res = []
    while i*i <= n:
        while n % i == 0:
            res.append(i)
            n /= i
        i += 1
    res.append(n)
    return sorted(res)

def dfs(array, a, b, pos):
    if len(array) == pos:
        return max(len(str(a)), len(str(b)))
    return min(dfs(array, a*array[pos], b, pos + 1), dfs(array, a, b*array[pos], pos + 1))

N = int(raw_input())
f = fact(N)
print dfs(f, 1, 1, 0)

Submission status: Accepted

Solution code:
import math

if __name__ == "__main__":
    N = int(input())
    n = len(str(N))
    for i in xrange(int(math.sqrt(N)), 1, -1):
        if N % i == 0:
            ii = N/i
            n = max(len(str(i)), len(str(ii)))
            break
    print(n)

Submission status: Accepted

Solution code:
n = int(raw_input())

idx = 1
min_len = float("inf")
while idx * idx <= n:
    if n % idx == 0:
        length = len(str(n/idx))
        if min_len > length:
            min_len = length
    idx += 1
    
print min_len

Submission status: Accepted

Solution code:
import math

def digits(n):
    if n == 0:
        return 0
    return digits(n/10) + 1

N = int(raw_input())
ans = digits(N)
for d in range(2, int(math.sqrt(N))+1):
    if d*d > N:
        break
    if N % d == 0:
        temp = max(digits(d), digits(N/d))
        if temp < ans:
            ans = temp
print ans

Submission status: Accepted

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

N = int(input())

#1*N
A_list = [int(math.log10(N)+1)]

A = 2

while A * A <= N:
	if N % A == 0:
		A_list.append(int(math.log10(N/A)+1))
	A += 1

print(min(A_list))

Submission status: Accepted

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

import math

n = int(raw_input())

i = 1
# sqn = math.ceil(math.sqrt(n))

while i * i <= n:
    if n % i == 0:
        ans = n / i
        #ans = int(math.log10(n / i)) + 1
    i += 1
print len(str(ans))#(ans)

Submission status: Accepted

Solution code:
#! coding: UTF-8
num = int(input())
#桁数
def digit(x):
    point = 0
    while int(x) > 0:
        x /= 10
        point += 1
    return point
#num=A*Bの時の最小桁数
def Multi(num):
    y = digit(num)
    A = 1
    while A*A <= num:
        if num%A == 0:
            B = num/A
            C = max(digit(A),digit(B))
            if y > C:
                y = C
        A += 1
    print(y)
Multi(num)

Submission status: Accepted

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

import sys
import os
import math


N_str = input().strip()
min_digit = len(N_str)

N = int(N_str)

MAX = int(math.sqrt(N)) + 1
min_digit = float('inf')

for i in range(1, MAX + 1):
    if N % i == 0:
        # 割れる
        digit0 = len(str(i))
        digit1 = len(str(int(N / i)))
        digit = max(digit0, digit1)
        if digit < min_digit:
            min_digit = digit
print(min_digit)

Submission status: Accepted

Solution code:
import math

N = int(input())

def enum(N,A):
    if(N % A == 0):
        B = N // A
        return (A,B)
    else:
        return 'NULL'

def F(tupleX):
    t = max(tupleX)
    return int(math.log10(t) + 1)

X = []
hu = int(math.sqrt(N)) + 1
for n in range(1,hu):
    X.append(enum(N,n))

Y = []
for x in X:
    if (x == 'NULL'):
        continue
    else:
        y = F(x)
        Y.append(y)

print(min(Y))

Submission status: Accepted

Solution code:
import numpy as np
def F(x,y):
    count = 1
    if x<=y:
        while y >= 10:
            y = y/10
            count += 1
        return count
    else :
        while x >= 10:
            x = x/10
            count += 1
        return count
#print F(1,13)
N = input()
min = 10**10
index = np.zeros(2)
for i in range(np.sqrt(N).astype(np.int32)):
    if N%(i+1) == 0:
       if min > F(i+1,N/(i+1)):
           min = F(i+1,N/(i+1))
           index[0] = i+1
           index[1] = N/(i+1)
       #print i+1, N/(i+1),F(i+1,N/(i+1)), min

print min

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    n = int(N**(0.5) + 1)
    while N % n > 0:
        n -= 1
    print(len(str(N // n)))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())


def func(n):
    return 11 if (N % n > 0) else len(str(N // n))

nn = min(range(1, int(N**(0.5) + 1)), key=func)
ans = len(str(N // nn))

print(ans)

Submission status: Accepted

Solution code:
N = int(input())


def func(n):
    if (N % n > 0):
        return 11
    else:
        # print("n = " + str(n) + ' ' + str(N // n))
        return len(str(N // n))

nn = min(range(1, int(N**(0.5) + 1)), key=func)
ans = len(str(N // nn))

print(ans)

Submission status: Accepted

Solution code:
import math

def F(A, B):
    return max(list(map(int, [math.log10(A), math.log10(B)])))+1


def main():
    N = int(input())
    max_ = 0
    for a in range(1, int(math.sqrt(N))+1):
        if N % a != 0:
            continue

        b = N/a
        v = F(a, b)
        if max_ < v:
            max_ = v
    print(v)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math


def main():
    n = int(input())
    res = f(1, n)
    for i in range(int(math.sqrt(n)), 0, -1):
        if n % i == 0:
            this_f = f(i, n // i)
            if this_f <= res:
                res = this_f
            else:
                break
    print(res)


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math


def main():
    n = int(input())
    res = f(1, n)
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0:
            res = min(res, f(i, n // i))
    print(res)


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math


def main():
    #infile = open("compprog.txt", mode="r")
    n = int(input())
    res = f(1, n)
    i = 2
    while i <= math.sqrt(n):
        if n % i == 0:
            this_f = f(i, n // i)
            res = this_f if this_f < res else res
        i += 1
    print(res)
    #infile.close()


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
import operator
from itertools import *
from functools import *


def main():
    #infile = open("compprog.txt", mode="r")
    n = int(input())
    res = -1
    divisors_found = set()
    for subset in powerset(prime_factors(n)):
        div1 = prod(subset)
        if div1 not in divisors_found:
            div2 = n // div1
            this_f = f(div1, div2)
            if res == -1 or this_f < res:
                res = this_f
            divisors_found.add(div1)
            divisors_found.add(div2)
    print(res)
    #infile.close()


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


def prime_factors(num):
    factor_list = []
    while num % 2 == 0:
        factor_list.append(2)
        num //= 2
    i = 3
    while i <= math.sqrt(num):
        if num % i == 0:
            factor_list.append(i)
            num //= i
            i = 3
        else:
            i += 2
    if num > 1:
        factor_list.append(num)
    return factor_list


def powerset(iterable):
    s = list(iterable)
    return list(chain.from_iterable(combinations(s, r) for r in range(len(s) + 1)))


def prod(iterable):
    return reduce(operator.mul, iterable, 1)



if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
max_div = 1
for i in range(1,int(np.sqrt(n))+1):
    if n % i == 0:
        max_div = n//i
ret = len(str(max_div))
print(ret)

Submission status: Accepted

Solution code:
import math

n = int(input())
f = 10

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

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

Submission status: Accepted

Solution code:
import math

def NumOfDigit(X):
    i=0
    while X>0:
        X//=10
        i+=1
    return i

def F(A,B):
    return max(NumOfDigit(A),NumOfDigit(B))

if __name__=="__main__":
    N=int(input())

    A,B=1,1
    now_min=NumOfDigit(N)
    while A<=math.sqrt(N):
        if N%A==0:   #Bは整数か？
            B=N/A     #A*B=Nが成立

            result=F(A,B)
            if result<now_min:
                now_min=result

        A+=1

    print(now_min)

Submission status: Accepted

Solution code:
import sys,math

N = int(raw_input())
n = int(math.sqrt(N)) + 1
d = None
for x in range(1, n):
	if (N % x == 0): d = x
print len(list(str(N / d)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n = int(input())
a = int(math.sqrt(n))
while n%a != 0: a-=1
print(len(str(n//a)))

Submission status: Accepted

Solution code:
import math
n = int(input())
nn = int(math.sqrt(n))
while n%nn != 0: nn-=1
ans = len(str(n//nn))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC057C

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
minf = 11
for i in range(1,N+1):
    if i**2 > N:
        break
    if N%i == 0:
        j = N/i ## j > i
    for k in range(1,12):
        if 10**k > j:
            if k < minf:
                minf = k
            else:
                break
print(minf)

Submission status: Accepted

Solution code:
N = int(raw_input())

for i in xrange(1, N+1):

    if i*i > N:
        break

    if N % i == 0:
        t = i

print len(str(N/t))

Submission status: Accepted

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

while i * i <= n:
    if n % i == 0:
        b = n // i
        f = len(str(max(ans, b)))
        ans = min(ans, f)

    i += 1

print(ans)

Submission status: Accepted

Solution code:
import itertools

n = int(input())


def prime_decomposition(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


n_table = prime_decomposition(n)
if not n_table:
    n_table.append(1)
f = 9999
#print(n_table)

for i in range(len(n_table) + 1):
#    print("\n" + str(i))
    i_a = itertools.combinations(n_table, i)

    while True:
        try:
            a = 1
            for j in next(i_a):
#                print("i_a=" + str(j))
                a *= j
            b = int(n / a)
#            print("b=" + str(b))
            _f = (len(str(max(a, b))))
        except StopIteration:
            break

        if _f < f:
            f = _f

print(f)

Submission status: Accepted

Solution code:
# coding: utf-8
import math

num_N = int(input())

min_num = 999999
sqrt_N = math.floor(math.sqrt(num_N))

for i in range(1, sqrt_N + 1):
    if num_N % i == 0:
        len_num_A = len(str(i))
        len_num_B = len(str(int(num_N / i)))
        min_num = min(min_num, max(len_num_A, len_num_B))

print(min_num)

Submission status: Accepted

Solution code:
N = int(raw_input())

for i in xrange(1, N+1):

    if i*i > N:
        break

    elif i*i == N:
        t = i
        break

    if N % i == 0:
        t = i

print len(str(N/t))

Submission status: Accepted

Solution code:
N = int(raw_input())
t = 1

for i in xrange(1, N):

    if i*i > N:
        break

    elif i*i == N:
        t = i
        break

    if N % i == 0:
        t = i

print len(str(N/t))

Submission status: Accepted

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

import math


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


n = int(input())
r, cur = math.floor(math.sqrt(n)), 999999

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

    ret = f(i, int(n / i))
    if ret < cur:
        cur = ret

print(cur)

Submission status: Accepted

Solution code:
from math import sqrt

# C-Digits in Multiplication
# 問題URl:http://abc057.contest.atcoder.jp/tasks/abc057_c

N = int(input())
F = 999;
for i in range(1,int(sqrt(N))+1):
    
    if N%i == 0: #余りが0 = iは整数なので整数同士の割り算ということ(余りを求める際には少数まで商を求めない）
        F =  min(F , max( len(str(i)) , len(str(N//i)) ) )
print(F)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def reduce(N):
    from math import sqrt, ceil
    from copy import deepcopy
    h_reductions = []
    for i in range(ceil(sqrt(N))):
        if N % (i+1) == 0:
            h_reductions.append(i+1)

    reductions = deepcopy(h_reductions)

    if h_reductions[-1]**2 != N:
        for i in range(len(h_reductions)):
            reductions.append(int(N/h_reductions[-1*i - 1]))
    else:
        for i in range(len(h_reductions)-1):
            reductions.append(int(N/h_reductions[-1*i - 2]))
    return reductions

N = int(input())

reductions = reduce(N)

print(len(str(int(reductions[len(reductions)//2]))))

Submission status: Accepted

Solution code:
import math


def midDivisor(n):
    k = int(math.sqrt(n))
    while n // k * k != n:
        k -= 1
    return k

n = int(input())
print(len(str(n // midDivisor(n))))

Submission status: Accepted

Solution code:
from math import *


def read(): return list(map(int, input().split()))

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


n = int(input())
ans = 114514
for a in range(1, int(sqrt(n)) + 1):
    if n % a != 0: continue
    b = n // a
    ans = min(ans, f(a, b))

print(ans)

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

print(ans)

Submission status: Accepted

Solution code:
import math


N = int(input())
Nsq = int(math.sqrt(N)) + 1
ans = 10**9

for n in range(1, Nsq):
    if N % n == 0:
        A = n
        B = N // n

        F = max(len(str(B)), len(str(A)))
        ans = min(ans, F)


print(ans)

Submission status: Accepted

Solution code:
import math

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

    a = int(math.sqrt(N))
    while a >= 1:
        if N % a == 0:
            break
        a -= 1
    b = int(N / a)
    print(len(str(b)))

main()

Submission status: Accepted

Solution code:

def countDigs(n):
	digs = 0
	while n > 0:
		digs += 1
		n = n // 10
	return digs

# def calcUpperLimit(n):
# 	x = 1
# 	if (n <= x**2):
# 		return int(n // 2) + 1
# 	for i in range(x, 0, -1):
# 		if (n % x == 0):
# 			return n // x + 1
# 	return int(n // 2) + 1

# def digs(n):
# 	for i in range(int((n + 0.1) ** 0.5), calcUpperLimit(n)):
# 		if (n % i == 0):
# 			print(countDigs(i))
# 			return
# 	print(countDigs(n))

def digs(n):
	for i in range(int((n + 0.1) ** 0.5), 0, -1):
		if n % i == 0:
			print(countDigs(n // i))
			return

digs(int(input()))

Submission status: Accepted

Solution code:
n = int(input())

a = []
b = []

import math

for i in range(1, math.floor(n**0.5) + 1):
    if n%i == 0:
        a.append(i)
        b.append(int(n/i))

a = list(map(str, a))
b = list(map(str, b))


result = []
for i in range(len(a)):
    result.append(max(len(a[i]), len(b[i])))

print(min(result))

Submission status: Accepted

Solution code:
import math

a = input()
b = int(math.sqrt(a)) + 1
c = 1
mi = 100

for i in range(1, b):
	if a % i == 0:
		d = a / i
	if max(len(str(i)), len(str(d))) < mi:
		mi = max(len(str(i)), len(str(d)))

print mi

Submission status: Accepted

Solution code:
import math
n=long(raw_input())
a=1
ans=0
while a*a<=n:
	if n%a==0:
		b=n/a
		ans=0
		while b>=1.0:
			ans+=1
			b/=10
	a+=1
print ans

Submission status: Accepted

Solution code:
import math
n=int(input())
tmp=math.ceil(n**0.5)+1
ans=1000000
for i in range(1,tmp):
    if n%i==0:
        tmp=n//i
        ans=min(ans,len(str(tmp)))

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def count_digit(N):
    return(len(str(N)))

ans = count_digit(N)

A = 1
while (A * A <= N):
    if N%A != 0: pass
    else:
        B = N//A
        curDig = max(count_digit(A), count_digit(B))
    ans = min(ans, curDig)
    A += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

score = len(str(N))

i = 2
while i ** 2 <= N:
    a, b = divmod(N, i)
    if b == 0:
        score = min(score, len(str(a)))
    i += 1
print(score)

Submission status: Accepted

Solution code:
import sys, array, re, functools
from math import sqrt, ceil; from itertools import count, islice
input = lambda: sys.stdin.readline()
@functools.lru_cache(maxsize = 10000)



def isPrime(n):
    return n > 1 and all(n%i for i in islice(count(2), int(sqrt(n)-1)))
def f(a, b):
  return  max(len(str(a)), len(str(b)))

def Main():
  N = int(input())
  v = -1
  if isPrime(N):
    print(len(str(N)))
  elif not isPrime(N):
    for i in range(1, ceil(sqrt(N)) + 1):
      if N%i == 0:
        t = f(int(i), int (N/i))
        if v == -1 or v > t:
          v = t
    print(v)
    
if __name__ == '__main__':
  Main()

Submission status: Accepted

Solution code:
import math

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

n = int(input())
v = -1
for i in range(1, math.ceil(math.sqrt(n)) + 1):
    if n % i == 0:
        t = f(int(i), int(n/i))
        if v == -1 or v > t:
            v = t
print(v)

Submission status: Accepted

Solution code:
from sys import stdin 
n = int(stdin.readline())
ans = 10**18 
i = 1 
while i*i <=n:
    if n%i==0:
        j = n/i 
        cur = max(len(str(i)) , len(str(j)))
        ans = min(ans,cur)
    i+=1 
print ans

Submission status: Accepted

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

r=None
for i in itertools.count(start=1,step=1):
    Q,R=divmod(N,i)
    if i>Q:
        break
    if R == 0:
        digitI = int(math.log10(i) + 1)
        digitQ = int(math.log10(Q) + 1)
        if r==None:
            r = max(digitI,digitQ)
        else:
            r=min(r,max(digitI,digitQ))
print r

Submission status: Accepted

Solution code:
N = int(raw_input())
t = 1
for i in xrange(1, N):

    if i*i > N:
        break

    elif i*i == N:
        t = i
        break

    if N % i == 0:
        t = i

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

Submission status: Accepted

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

import math

N = int(input())
ans = 1e10
for i in range(1, int(math.sqrt(N)) + 1):
    j = N // i
    if N == i * j:
        ans = min(ans, max(len(str(i)), len(str(N // i))))
print(ans)

Submission status: Accepted

Solution code:
import math


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


N = int(input())
mi = 10**10
for i in range(1, int(math.sqrt(N)) + 1):
    if N % i == 0:
        mi = min(mi, f(i, int(N/i)))
print(mi)

Submission status: Accepted

Solution code:
import math

N = input()

a=[]

for i in range(1, int(math.sqrt(N)+1)):
    if(N%i==0):
        a.append(i)

b=[]

for i in a:
    x=int(math.log10(i) + 1)
    y=int(math.log10(N/i) + 1)
    b.append(max([x,y]))

print min(b)

Submission status: Accepted

Solution code:
import itertools

n = int(input())
factor = []
div = 2
while n >= div*div:
    if n % div == 0:
        factor.append(max(div,n//div))
    div += 1
factor.append(int(n))
print(len(str(min(factor))))

Submission status: Accepted

Solution code:
import sys
import math

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func()
    top_str = input_raw.strip().split()
    [N] = [int(top_str[0])]

    min_F = sys.maxint
    digit = int(math.log10(N) + 1)
    for i in range(10 ** int((digit)/2.0 + 0.5) , 0 , -1):
        if(N % i == 0):
            A = i
            B = N/i
            F = max(int(math.log10(A) + 1), int(math.log10(B) + 1))
            if F < min_F:
                min_F = F
            #break
    print min_F



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

n=int(input())

def keta(n):
    return int(math.log10(n)+1)
def max(a,b):
    if a>b :return a
    else: return b

result=100
for i in range(1,math.ceil(math.sqrt(n)+3)):
    if n%i==0 and result>max(keta(i),keta(n//i)):
        result=max(keta(i),keta(n//i))
print(result)

Submission status: Accepted

Solution code:
import math
n=int(input())
m=int(math.sqrt(n))
i=0
while 1:
 if n%(m-i)==0 and n%(m+i+1)==0:
  print(min(int(math.log10(n/(m-i))),int(math.log10(m+i+1)))+1)
  break
 if n%(m-i)==0:
  print(int(math.log10(n/(m-i)))+1)
  break
 if n%(m+1+i)==0:
  print(int(math.log10(m+i+1))+1)
  break
 i+=1

Submission status: Accepted

Solution code:
from math import sqrt

def numLen(num):
  return len(str(abs(num)))

def F(a, b):
    return max(numLen(a), numLen(b))

N = int(input())
sqrtN = int(sqrt(N))

p = (0, 0)
for i in range(1,sqrtN+1):
    if N % i == 0 and p[0] < i:
        p = (i, N//i)

print(F(p[0], p[1]))

Submission status: Accepted

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

N = int(input())
r = math.sqrt(N)
R = int(r)
if r == R:
    print(len(str(R)))
    quit()
for i in range(R + 1, 3, -1):
    if N % i == 0:
        b = int(N / i)
        if len(str(i)) >= len(str(b)):
            print (len(str(i)))
        else:
            print (len(str(b)))
        quit()
print(len(str(N)))

Submission status: Accepted

Solution code:
import math

N=int(raw_input())

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

while(N%n!=0): n-=1

m=N/n
n=int(n)
m=int(m)

if n>=m:
    print len(str(n))
else:
    print len(str(m))

Submission status: Accepted

Solution code:
import math

n=int(input())

res=float('inf')
for i in range(1,int(math.sqrt(n))+10):
    if n%i==0:
        res=min(res,max(len(str(i)),len(str(n//i))))
print(res)

Submission status: Accepted

Solution code:
import math

N = int(input())

for i in range(1, math.ceil(math.sqrt(N)) + 1):
    if N % i == 0:
        factor1 = N / i
        factor2 = i

factor1 = int(factor1)

if factor1 < factor2:
    print(len(str(factor2)))
else:
    print(len(str(factor1)))

Submission status: Accepted

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

Submission status: Accepted

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

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        n = int(input())
        candidate = int(math.sqrt(float(n)))

        for i in range(candidate, 0, -1):
            if n % i == 0:
                print(max(int(math.log10(i)) + 1, int(math.log10(n / i)) + 1))
                break
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()

Submission status: Accepted

Solution code:
import sys
import math

INF = 10**9+7

stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().strip()
def nsl(): return list(stdin.readline().strip())
def ni(): return int(stdin.readline())
def nil(): return list(map(int, stdin.readline().split()))

a = b = INF
n = ni()

x = int(math.sqrt(n) // 1 + 1)
for i in reversed(range(x)):
    if((n/i) == (n//i)):
        a = i
        b = n // i
        break

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

Submission status: Accepted

Solution code:

import sys, math

ifnt = 168430090

def lg(x):
	bwl = 0
	while x > 0:
		x /= 10
		bwl = bwl + 1
	
	return bwl


#sys.stdin = open("test.in", "r")
n = input()
ans = ifnt
for i in range(int(math.sqrt(n))):
	if n % (i + 1) == 0:
		ans = min(ans, max(lg(i + 1), lg(n / (i + 1))))
	
print ans

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:
import math
def digit(X):
    d = 0
    while X:
        X //= 10
        d += 1
    return d

def F(A, B):
    return max(digit(A), digit(B))

N = int(input())

min_F = 20
max_div = round(math.sqrt(N)) + 10
for i in range(1, max_div):
    if N % i == 0:
        f = F(i, N/i)
        if f < min_F:
            min_F = f
print(min_F)

Submission status: Accepted

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


def div_pairs(n):
    for i in range(1, n + 1):
        if i * i > n:
            break
        d, m = divmod(n, i)
        if m == 0:
            yield (i, d)


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


def solve(n):
    return min(f(a, b) for a, b in div_pairs(n))


def main():
    print(solve(int(input())))


if __name__ == '__main__':
    main()

Submission status: Accepted

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


def main():
    N = int(input())
    min_f = 10
    for i in range(1, N + 1):
        if i ** 2 > N:
            break
        if N % i != 0:
            continue
        f_v = f(i, N // i)
        if f_v < min_f:
            min_f = f_v
    print(min_f)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/python

import math
import sys

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

def main(argv):
    for line in sys.stdin:
        n = int(line)

        small= 0
        for i in xrange(int(math.sqrt(n)), 0, -1):
            if n % i == 0:
                small = i
                break

        print F(small, n / small)

if __name__ == "__main__":
    main(sys.argv)

Submission status: Accepted

Solution code:
import itertools,math,bisect,pprint,sys
#n, m = map(int, raw_input().split())
n = input()
res = 10**5
for i in range(1,int(math.sqrt(n)+1)):
    a = i
    if n%i==0:
        b = n/a
        res = min(res,max(len(str(a)),len(str(b))))
print res

Submission status: Accepted

Solution code:
import math

if __name__ == '__main__':
    n = int(input())
    ans = float('inf')

    a = 1
    while a <= math.sqrt(n):
        if n % a == 0:
            b = n // a
            f = max(math.floor(math.log10(a) + 1), math.floor(math.log10(b) + 1))
            ans = min(f, ans)

        a += 1

    print(ans)

Submission status: Accepted

Solution code:
import math
n=int(raw_input())
sq=math.sqrt(n)
ans=None



if str(sq)[-2]=='.':
    print len(str(sq))-2
else:
    nu=[]
    while sq>1:
        sq=int(sq)
        if n%sq==0:
            nu.append(str(sq))
            nu.append(str(n/sq))
            sq-=1
            break
        else:
            sq-=1
    if len(nu)!=0:
        nu.sort(key=len)
        print len((nu[1]))
    else:
        print len(str(n))

Submission status: Accepted

Solution code:
n = int(input())
n_sqrt = int(n ** 0.5) + 1

max_len = 0
for a in range(1, n_sqrt + 1):
    if n % a == 0:
        b = str(n//a)
        max_len = max(len(b), len(str(a)))

print(max_len)