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: Wrong Answer

Solution code:
def fdigit(a,b):
    if len(str(a)) > len(str(b)):
        return len(str(a))
    else:
        return len(str(b))

N = int(input())
result = 10000000000
goal = int((N**0.5)//1)

for i in range(1, goal):
    if N%i ==0:
        if result > fdigit(i, N//i):
            result = fdigit(i, N//i)
            print(i, N/i,fdigit(i, N//i))

print(result)

Submission status: Wrong Answer

Solution code:
import numpy
s = list(map(int, input().split()))
n=s[0]
ans=11
for a in range(1,int(numpy.sqrt(n))):
    b=n/a
    if b.is_integer():
        b=int(b)
        if max(len(str(a)),len(str(b)))<ans:
            ans = max(len(str(a)), len(str(b)))
print(ans)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

sosuu = 1
B = 1
for i in range(1,int(math.sqrt(N+1))):
    if N % i == 0:
        sosuu = i
        B = N // i

print(len(str(max(sosuu, B))))

Submission status: Wrong Answer

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

def prime_factorization(n):
    ret = {}
    for i in range(2,int(math.sqrt(n)+1)):
        cnt = 0
        while True:
            if n%i == 0:
                n = n//i
                if i in ret:
                    ret[i] += 1
                else:
                    ret[i] = 1
            else:
                break
    if n != 1:
        ret[n] = 1
    return ret

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

a = 1
b = 1
for key,value in sorted(prime_factorization(n).items(), key=lambda x:x[0], reverse=True):
    for _ in range(value):
        if f(a*key,b) <= f(b*key,a):
            a *= key
        else:
            b *= key
print(f(a,b))

Submission status: Wrong Answer

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

def prime_factorization(n):
    ret = {}
    for i in range(2,int(math.sqrt(n)+1)):
        cnt = 0
        while True:
            if n%i == 0:
                n = n//i
                if i in ret:
                    ret[i] += 1
                else:
                    ret[i] = 1
            else:
                break
    if n != 1:
        ret[n] = 1
    return ret

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

factorization(24)


a = 1
b = 1
#for key,value in sorted(prime_factorization(n).items(), key=lambda x:x[0], reverse=True):
for key,value in sorted(factorization(n), reverse=True):
    for _ in range(value):
        if a >= b:
            b *= key
        else:
            a *= key
#    print(f'{a} {b}')
#print(f'{a} {b}')
print(f(a,b))

Submission status: Wrong Answer

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

def prime_factorization(n):
    ret = {}
    for i in range(2,int(math.sqrt(n)+1)):
        cnt = 0
        while True:
            if n%i == 0:
                n = n//i
                if i in ret:
                    ret[i] += 1
                else:
                    ret[i] = 1
            else:
                break
    if n != 1:
        ret[n] = 1
    return ret

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


a = 1
b = 1
for key,value in  sorted(prime_factorization(n).items(), key=lambda x:x[0], reverse=True):
    for _ in range(value):
        if a >= b:
            b *= key
        else:
            a *= key
print(f(a,b))

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
lim=math.ceil(math.sqrt(n))
ans=n
for i in range(1, lim):
  if not n%i:
    ans = min(ans, len(str(n//i)))
    
print(ans)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
lim=math.ceil(math.sqrt(n))
ans=n
for i in range(1, lim):
  if n%i==0:
    ans = min(ans, len(str(n//i)))
    
print(ans)

Submission status: Wrong Answer

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

for i in range(lim, n+1):
  if n%i==0:
    print(len(str(i)))
    exit()
  elif n+1/2>i:
    print(len(str(n)))
    exit()

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 10 ** 10
for q in range(1, int(n ** 0.5)):
    if not n % q:
        ans = min(ans, len(str(n // q)))

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 10 ** 10 ** 0.5
for q in range(1, int(n ** 0.5)):
    if not n % q:
        ans = min(ans, len(str(n // q)))

print(ans)

Submission status: Wrong Answer

Solution code:
def comp_digit(x,y):
  x = str(x)
  y = str(y)
  return max(len(x),len(y))

def factorize(n):
    b = 2
    fct = []
    sosu = 1
    keta = 10**9
    while b * b <= n:
        while n % b == 0:
            n //= b
            sosu *= b
            digit = comp_digit(n,sosu)
            if keta > digit:
              keta = digit
            #fct.append(b)
        b = b + 1
    if n > 1:
        keta = len(str(n))
    return keta

n = int(input())
print(factorize(n))

Submission status: Wrong Answer

Solution code:
# ABC 57 C
n = int(input())
def divisor(n):
    div_list = []
    for i in range(1, int(1+ n**0.5)):
        if n%i == 0 and i**2 == n:
            div_list.append(i)
        elif n%i == 0:
            div_list.append(i)
            div_list.append(int(n/i))
    return div_list
ln = sorted(divisor(n))
print(len(str(ln[-1*int(len(ln)/2)])))

Submission status: Wrong Answer

Solution code:
def pfact(n):
    d = {}
    while n % 2 == 0:
        d[2] = 1 if 2 not in d else d[2] + 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            d[f] = 1 if f not in d else d[f] + 1
            n //= f
        else:
            f += 2
    if n != 1:
        d[n] = 1 if n not in d else d[n] + 1
    return d

n = int(input())
d = pfact(n)
d[1] = 1
L = sorted(d, reverse=True)
a = L[0]
d[L[0]] -= 1
b = 1
for k in L:
    while d[k] > 0:
        if b > a:
            a, b = b, a
        b *= k
        d[k] -= 1
print(max(len(str(a)), len(str(b))))

Submission status: Wrong Answer

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

main(n)

Submission status: Wrong Answer

Solution code:
from itertools import *
def p(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
ans=10
a=p(int(input()))
a+=[1]   
c=1
for i in a:
    c*=i
for i in range(1,len(a)):
    for j in combinations(a,i):
        b=1
        for k in j:
            b*=k
        ans=min(ans,max(len(str(b)),len(str(c//b))))
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import *
def p(n):
    a=[1]
    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
ans=10
a=p(int(input()))
c=1
for i in a:
    c*=i
for i in range(1,len(a)):
    for j in combinations(a,i):
        b=1
        for k in j:
            b*=k
        ans=min(ans,max(len(str(b)),len(str(c//b))))
print(ans)

Submission status: Wrong Answer

Solution code:
#4問目
import math
N = int(input())
yakusuu = []
#約数列挙して桁数が小さいやつを抜き出せばOK
for i in range(1, math.ceil(N ** (1/2))+1):
    if N % i == 0:
        yakusuu.append([i, int(N/i)])
keta1 = 0
keta2 = 10 ** 10
for i in yakusuu:
    if len(str(i[0])) > keta1 and len(str(i[1])) < keta2:
        keta1 = len(str(i[0]))
        keta2 = len(str(i[1]))
print(max(keta1, keta2))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = 0
B = 0
num = 0
ans = 10**10

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = 0
B = 0
num = 0
ans = 10**10

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

Submission status: Wrong Answer

Solution code:
from math import sqrt,log10,floor

n = int(input())

for i in range(1, floor(sqrt(n))+1)[::-1]:
    print(i)
    if n % i == 0:
        print(floor(log10(n//i))+1)
        break

Submission status: Wrong Answer

Solution code:
from math import sqrt,log10,ceil,floor

n = int(input())

for i in range(1, floor(sqrt(n))+1)[::-1]:
    if n % i == 0:
        print(ceil(log10(n//i)))
        break

Submission status: Wrong Answer

Solution code:
from math import sqrt,log10,ceil,floor

n = int(input())

for i in range(1, floor(sqrt(n))+1)[::-1]:
    if n % i == 0:
        print(ceil(log10(n/i)))
        break

Submission status: Wrong Answer

Solution code:
from math import sqrt,log10,ceil,floor

n = int(input())

for i in range(1, floor(sqrt(n)))[::-1]:
    if n % i == 0:
        print(ceil(log10(n//i)))
        break

Submission status: Wrong Answer

Solution code:
from math import sqrt,log10,ceil,floor

n = int(input())

for i in range(1, floor(sqrt(n)))[::-1]:
    if n % i == 0:
        print(ceil(log10(n/i)))
        break

Submission status: Wrong Answer

Solution code:
from math import sqrt,log10,ceil

n = int(input())

for i in range(1,ceil(sqrt(n)))[::-1]:
    if n % i == 0:
        print(ceil(log10(n/i)))
        break

Submission status: Wrong Answer

Solution code:
from math import sqrt,log10,ceil

n = int(input())

for i in range(1,ceil(sqrt(n)))[::-1]:
    print(i)
    if n % i == 0:
        print(ceil(log10(n/i)))
        break

Submission status: Wrong Answer

Solution code:
from math import sqrt,log10,ceil

n = int(input())

for i in range(1,ceil(sqrt(n)))[::-1]:
    if n % i == 0:
        print(ceil(log10(max(i, n/i))))
        break

Submission status: Wrong Answer

Solution code:
n = int(input())
i = 1
divisor = (1 + n) // 2
min_value = 10 ** 10 + 1
while i < divisor:
    if n % i == 0:
        divisor = min(n // i, divisor)
        if max(len(str(i)),len(str(n // i))) > min_value:
            break
        min_value = min(min_value,max(len(str(i)),len(str(n // i))))
    i += 1
print(min_value)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

import math

N = int(input())
def checklen(A, B):
    return max(len(str(A)), len(str(B)))

ans = float("inf")
M = round(math.sqrt(N))
for i in range(1, M):
    if N % i == 0:
        m = round(N/i)
        ans = min(checklen(i, m), ans)
print(ans)

Submission status: Wrong Answer

Solution code:

N = int(input())
def checklen(A, B):
    return max(len(str(A)), len(str(B)))

ans = float("inf")
for i in range(1,N):
    if N % i == 0:
        m = round(N/i)
        ans = min(checklen(i, m), ans)
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
# from collections import defaultdict, deque
from math import log10, sqrt, ceil
def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline()[:-1]

def c(x):
    cnt = 0
    n = x
    while n:
        n //= 10
        cnt += 1
    return cnt

def solve():
    n = int(input())
    o = n
    ans = c(n)
    for i in range(2, int(sqrt(n)) + 1):
        if (n % i == 0):
            n //= i
            a = i
            b = o // a
            ans = min(ans, max(c(a), c(b)))
        if i > n:
            break

    print(ans)
    
        




t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()



"""
1 -> (1, 2) -> (2 ** 3, 3) -> (3, 1)
100000007
"""

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
# from collections import defaultdict, deque
from math import log10, sqrt, ceil
def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline()[:-1]

def c(x):
    cnt = 0
    n = x
    while n:
        n //= 10
        cnt += 1
    return cnt

def solve():
    n = int(input())
    o = n
    ans = c(n)
    for i in range(2, int(sqrt(n)) + 1):
        while (n % i == 0):
            n //= i
            a = n
            b = o // a
            ans = min(ans, max(c(a), c(b)))
        if i > n:
            break

    print(ans)
    
        




t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()



"""
1 -> (1, 2) -> (2 ** 3, 3) -> (3, 1)
100000007
"""

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
# from collections import defaultdict, deque
from math import log10, sqrt, ceil
def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline()[:-1]

def c(x):
    cnt = 0
    n = x
    while n:
        n //= 10
        cnt += 1
    return cnt

def solve():
    n = int(input())
    o = n
    ans = c(n)
    for i in range(2, ceil(sqrt(n)) + 1):
        while (n % i == 0):
            n //= i
            a = n
            b = o // a
            ans = min(ans, max(c(a), c(b)))
        if n == 1:
            break

    print(ans)
    
        




t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()



"""
1 -> (1, 2) -> (2 ** 3, 3) -> (3, 1)
100000007
"""

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
# from collections import defaultdict, deque
from math import log10, sqrt, ceil
def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline()[:-1]

def c(x):
    cnt = 0
    n = x
    while n:
        n //= 10
        cnt += 1
    return cnt

def solve():
    n = int(input())
    o = n
    ans = c(n)
    for i in range(2, ceil(sqrt(n)) + 1):
        while (n % i == 0):
            n //= i
            a = n
            b = o // a
            print(a,b)
            ans = min(ans, max(c(a), c(b)))
        if n == 1:
            break

    print(ans)
    
        




t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()



"""
1 -> (1, 2) -> (2 ** 3, 3) -> (3, 1)
100000007
"""

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
# from collections import defaultdict, deque
from math import log10, sqrt, ceil
def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline()[:-1]

def c(x):
    cnt = 0
    n = x
    while n:
        n //= 10
        cnt += 1
    return cnt

def solve():
    n = int(input())
    o = n
    ans = c(n)
    for i in range(2, int(sqrt(n)) + 1):
        while (n % i == 0):
            n //= i
            a = n
            b = o // a
            ans = min(ans, max(c(a), c(b)))
        if n == 1:
            break

    print(ans)
    
        




t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()



"""
1 -> (1, 2) -> (2 ** 3, 3) -> (3, 1)
100000007
"""

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
# from collections import defaultdict, deque
from math import log10, sqrt, ceil
def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline()[:-1]

def c(x):
    cnt = 0
    n = x
    while n:
        n //= 10
        cnt += 1
    return cnt

def solve():
    n = int(input())
    o = n
    ans = c(n)
    for i in range(2, ceil(sqrt(n))):
        while (n % i == 0):
            n //= i
            a = n
            b = o // a
            ans = min(ans, max(c(a), c(b)))
        if n == 1:
            break

    print(ans)
    
        




t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()



"""
1 -> (1, 2) -> (2 ** 3, 3) -> (3, 1)
100000007
"""

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
# from collections import defaultdict, deque
from math import log10, sqrt, ceil
def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline()[:-1]

def c(x):
    cnt = 0
    n = x
    while n:
        n //= 10
        cnt += 1
    return cnt

def solve():
    n = int(input())
    o = n
    ans = c(n)
    for i in range(2, ceil(sqrt(n))):
        while (n % i == 0):
            n //= i
            a = n
            b = o // a
            ans = min(ans, max(c(a), c(b)))

    print(ans)
    
        




t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()



"""
1 -> (1, 2) -> (2 ** 3, 3) -> (3, 1)

"""

Submission status: Wrong Answer

Solution code:
N = int(input())
import math
n = int(math.sqrt(N))
s = 0
for i in range(1,n+1):
  if N % i == 0:
    s = i
a = s
b = N/s
A = math.log10(a)
B = math.log10(b)
A = int(math.ceil(A))
B = int(math.ceil(B))
ans = max(A,B)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
import math
n = int(math.sqrt(N))
s = 0
for i in range(1,n+1):
  if N % i == 0:
    s = i
a = s
b = N/s
A = math.log10(a)
B = math.log10(b)
A = math.ceil(A)
B = math.ceil(B)
ans = max(A,B)
ans = int(ans)
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    base = n
    f = []
    i = 2
    while i * i <= n:
        if n % i == 0:
            f.append(i)
            if i * i != n:
                f.append(n // i)
        i += 1
    if n != 1:
        f.append(n)
    f.sort()
    answer = float("inf")
    for ff in f:
        answer = min(answer, max(len(str(ff)), len(str(base // ff))))
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def f(a,b):
  a=str(a)
  b=str(b)
  return max(len(a),len(b))
n=int(input())
ans=10**10
for i in range(1,n):
  j=n//i
  if n%i:continue
  ans=min(ans,f(i,j))
  if j<i:break
print(ans)

Submission status: Wrong Answer

Solution code:
def f(a,b):
  a=str(a)
  b=str(b)
  return max(len(a),len(b))
n=int(input())
ans=10**10
for i in range(1,n):
  if n%i:continue
  j=n//i
  if j<i:break
  ans=min(ans,f(i,j))
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
m = n * 1

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

sqr = int(n**0.5)
l1 = len(str(sqr))

pf = {}
for i in range(2, int(m**0.5) + 1):
    while not m % i:
        pf[i] = pf.get(i, 0) + 1
        m //= i
if m > 1:
    pf[m] = 1

ls = sorted(pf.items(), key=lambda x: x[0], reverse=True)
l2 = len(str(ls[0][0]))
other = n // ls[0][0]
l3 = len(str(other))

print(max(l1, l2, l3))

Submission status: Wrong Answer

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


def read():
    N = int(input().strip())
    return N,


def solve(N):
    AB = []
    for a in range(1, N):
        if a * a > N:
            break
        if N % a == 0:
            b = N // a
            AB.append((a, b))
    minl = 100000000
    for a, b in AB:
        minl = min(minl, max(len(str(a)), len(str(b))))
    return minl


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

Submission status: Wrong Answer

Solution code:
N = int(input())
prime_list = [2]

for i in range(3,int(N**0.5)+1):
  flag = True
  for j in range(2,int(i**0.5)+1):
    # print(i,j)
    if i % j == 0:
      flag = False
      break
  if flag:
    prime_list.append(i)
    
# 素因数分解して、２つに分けていく
A = []
 
for i in sorted(prime_list,reverse=True):
  while N % i == 0:
    N //= i
    A.append(i)
if N != 1:
  A.append(N)
ans = [1,1]
for a in A[::-1]:
  ans[0] *= a
  ans.sort()
print(max(len(str(ans[0])), len(str(ans[1]))))

Submission status: Wrong Answer

Solution code:
N = int(input())
prime_list = []

for i in range(2,int(N**0.5)):
  if N % i == 0:
    prime_list.append(i)
    
# 素因数分解して、２つに分けていく
A = [1,1]

for i in sorted(prime_list,reverse=True):
  while N % i == 0:
    N //= i
    A[0] *= i
    A.sort()
else:
  A[0] *= N
print(max(len(str(A[0])), len(str(A[1]))))

Submission status: Wrong Answer

Solution code:
N = int(input())

x = []
for i in range(1, int((N+1)**0.5)+1):
  if N % i == 0:
    x.append(i)

y = int(N/x[-1])
print(y)
print(len(str(y)))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

ans = 1000000000
for A in range(1, int((N+1)**(1/2))):
    if N%A == 0:
        B = int(N / A)
        if F(A, B) < ans:
            ans = F(A, B)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

ans = 1000
for A in range(1, int((N+1)**(1/2))):
    if N%A == 0:
        B = int(N / A)
        if F(A, B) < ans:
            ans = F(A, B)

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = float('inf')
temp = 0
for i in range(1,int(n**(1/2))):
    if n%i == 0:
        temp = max(i, n//i)
        ans = min(temp, ans)
print(len(str(ans)))

Submission status: Wrong Answer

Solution code:
from math import sqrt
from itertools import product
import numpy as np
import sys

n = int(input())
p = []
def factorization(arg):
    while arg % 2 == 0:
        p.append(2)
        arg //= 2
    for i in range(3, int(sqrt(arg)) + 1, 2):
        while arg % i == 0:
            p.append(i)
            arg //= i
    if arg > 1:
        p.append(arg)
if n == 1:
    print(1)
else:
    factorization(n)
    q = np.array(p) - 1
    min = sys.maxsize
    for bit in product(range(2), repeat=len(p)):
        a = np.prod(q * bit + 1)
        b = np.prod(q - q * bit + 1)
        if min > len(str(a)) if len(str(a)) >= len(str(b)) else len(str(b)):
            min = len(str(a)) if len(str(a)) >= len(str(b)) else len(str(b))
    print(min)

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    m = 1
    k = int(n ** 0.5)

    ans = len(str(n))
    for i in range(1, k + 1):
        if n % i == 0:
            n = n // i
            m *= i
            tmp = max(len(str(m)), len(str(n)))
            ans = min(ans, tmp)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from math import sqrt
from itertools import product
import sys

n = int(input())
p = []
def factorization(arg):
    while arg % 2 == 0:
        p.append(2)
        arg //= 2
    for i in range(3, int(sqrt(arg)) + 1, 2):
        while arg % i == 0:
            p.append(i)
            arg //= i
    if arg > 1:
        p.append(arg)
if n == 1:
    print(1)
else:
    factorization(n)
    min = sys.maxsize
    for bit in list(product([False, True], repeat=len(p))):
        a = 1
        b = 1
        for i in range(len(p)):
            if bit[i]:
                a *= p[i]
            else:
                b *= p[i]
        if min > len(str(a)) if len(str(a)) >= len(str(b)) else len(str(b)):
            min = len(str(a)) if len(str(a)) >= len(str(b)) else len(str(b))
    print(min)

Submission status: Wrong Answer

Solution code:
from math import sqrt
import sys

n = int(input())
p = []
def factorization(arg):
    while arg % 2 == 0:
        p.append(2)
        arg //= 2
    for i in range(3, int(sqrt(arg)) + 1, 2):
        while arg % i == 0:
            p.append(i)
            arg //= i
    if arg > 1:
        p.append(arg)
if n == 1:
    print(1)
else:
    factorization(n)
    print(p)
    min = sys.maxsize
    for bit in range(2 ** len(p)):
        a = 1
        b = 1
        for i in range(len(p)):
            if ((bit >> i) & 1):
                a *= p[i]
            else:
                b *= p[i]
        if min > len(str(a)) if len(str(a)) >= len(str(b)) else len(str(b)):
            min = len(str(a)) if len(str(a)) >= len(str(b)) else len(str(b))
    print(int(min))

Submission status: Wrong Answer

Solution code:
from math import sqrt
from itertools import product
import sys

n = int(input())
p = []
def factorization(arg):
    while arg % 2 == 0:
        p.append(2)
        arg //= 2
    for i in range(3, int(sqrt(arg)) + 1, 2):
        while arg % i == 0:
            p.append(i)
            arg //= i
    if arg > 1:
        p.append(arg)
if n == 1:
    print(1)
else:
    factorization(n)
    print(p)
    min = sys.maxsize
    for bit in range(2 ** len(p)):
        a = 1
        b = 1
        for i in range(len(p)):
            if ((bit >> i) & 1):
                a *= p[i]
            else:
                b *= p[i]
        if min > len(str(a)) if len(str(a)) >= len(str(b)) else len(str(b)):
            min = len(str(a)) if len(str(a)) >= len(str(b)) else len(str(b))
    print(min)

Submission status: Wrong Answer

Solution code:
from math import sqrt
from itertools import product
import sys

n = int(input())
p = []
def factorization(arg):
    while arg % 2 == 0:
        p.append(2)
        arg /= 2
    for i in range(3, int(sqrt(arg)) + 1, 2):
        while arg % i == 0:
            p.append(i)
            arg /= i
    if arg > 1:
        p.append(int(arg))
if n == 1:
    print(1)
else:
    factorization(n)
    print(p)
    min = sys.maxsize
    for bit in range(2 ** len(p)):
        a = 1
        b = 1
        for i in range(len(p)):
            if ((bit >> i) & 1):
                a *= p[i]
            else:
                b *= p[i]
        if min > len(str(a)) if len(str(a)) >= len(str(b)) else len(str(b)):
            min = len(str(a)) if len(str(a)) >= len(str(b)) else len(str(b))
    print(min)

Submission status: Wrong Answer

Solution code:
from math import sqrt
from itertools import product
import sys

n = int(input())
p = []
def factorization(arg):
    while arg % 2 == 0:
        p.append(2)
        arg /= 2
    for i in range(3, int(sqrt(arg)) + 1, 2):
        while arg % i == 0:
            p.append(i)
            arg /= i
    if arg > 1:
        p.append(arg)
if n == 1:
    print(1)
else:
    factorization(n)
    min = sys.maxsize
    for bit in range(2 ** len(p)):
        a = 1
        b = 1
        for i in range(len(p)):
            if ((bit >> i) & 1):
                a *= p[i]
            else:
                b *= p[i]
        if min > len(str(a)) if len(str(a)) >= len(str(b)) else len(str(b)):
            min = len(str(a)) if len(str(a)) >= len(str(b)) else len(str(b))
    print(min)

Submission status: Wrong Answer

Solution code:
from math import sqrt
from itertools import product
import sys

n = int(input())
p = []
def factorization(arg):
    while arg % 2 == 0:
        p.append(2)
        arg /= 2
    for i in range(3, int(sqrt(arg)) + 1, 2):
        while arg % i == 0:
            p.append(i)
            arg /= i
    if arg > 1:
        p.append(arg)
if n == 1:
    print(1)
else:
    factorization(n)
    min = sys.maxsize
    for bit in list(product([False, True], repeat=len(p))):
        a = 1
        b = 1
        for i in range(len(p)):
            if bit[i]:
                a *= p[i]
            else:
                b *= p[i]
        if min > len(str(a)) if len(str(a)) >= len(str(b)) else len(str(b)):
            min = len(str(a)) if len(str(a)) >= len(str(b)) else len(str(b))
    print(min)

Submission status: Wrong Answer

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

def F_ab(a, b):
    a_len = len(str(a))
    b_len = len(str(b))
    
    if(a_len >= b_len):
        return a_len
    else:
        return b_len
    
n = math.floor(N ** (1/2))

min_f = 999999999999
for a in range(1, n + 1):
    b = N/a
    b = math.floor(b)
    f = F_ab(a, b)
    if(min_f > f):
        min_f = f
        
print(min_f)

Submission status: Wrong Answer

Solution code:
def F(a,b):
    a=len(str(a))
    b=len(str(b))-2#float型のため
    return a if a>b else b
n=int(input())
k=100000000
m=10000000000
for i in range(1,n):
    if (n/i).is_integer():
        k=F(i,n/i)
        if k>m:
            break
        m=k
try:
    print(m)
except:
    print(1)

Submission status: Wrong Answer

Solution code:
def F(a,b):
    a=len(str(a))
    b=len(str(b))-2#float型のため
    return a if a>b else b
n=int(input())
o=[]
k=100000000
m=10000000000
i=1
for _ in range(1,n):
    s=n/i
    if s.is_integer():
        k=F(i,s)
        o.append(k)
        if k>m:
            break
        m=k
        i=int("1"+"0"*len(str(i)))#iを次の位にする
    i+=1
try:
    print(min(o))
except:
    print(1)

Submission status: Wrong Answer

Solution code:
def F(a,b):
    a=len(str(a))
    b=len(str(b))-2#float型のため
    return a if a>b else b
n=int(input())
o=[]
k=100000000
m=10000000000
i=1
for _ in range(1,n):
    s=n/i
    if s.is_integer():
        k=F(i,s)
        o.append(k)
        if k>m:
            break
        m=k
        i=int("1"+"0"*len(str(i)))-i#iを次の位にする
    i+=1
try:
    print(min(o))
except:
    print(1)

Submission status: Wrong Answer

Solution code:
def F(a,b):
    a=len(str(a))
    b=len(str(b))-2#float型のため
    return a if a>b else b
n=int(input())
k=100000000
m=100000000
i=1
while True:
    s=n/i
    if s.is_integer():
        k=F(i,s)
        if k>m:
            break
        m=k
        i=int("1"+"0"*len(str(i)))#iを次の位にする
        continue
    i+=1
    if i>=n:
        break
try:
    print(m)
except:
    print(1)

Submission status: Wrong Answer

Solution code:
def F(a,b):
    a=len(str(a))
    b=len(str(b))-2#float型のため
    return a if a>b else b
n=int(input())
o=[]
k=100000000
m=10000000000
for i in range(1,n,3):
    s=n/i
    if s.is_integer():
        k=F(i,s)
        o.append(k)
        if k>m:
            break
        m=k
        i=int("1"+"0"*len(str(i)))-i#iを次の位にする
try:
    print(min(o))
except:
    print(1)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans1 = 0

A = '1'
B = str(N)

if len(A)>=len(B):
    ans = len(A)
else:
    ans = len(B)
    
for i in range(2,N+1):
    A = i
    if N%A==0:
        B = int(N / A)
        A = str(A)
        B = str(B)
        print(A, B)
        if len(A)>=len(B):
            ans1 = len(A)
        else:
            ans1 = len(B)
        if ans1 <= ans:
            ans = ans1
    if len(str(A))==len(str(B)):
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import math

N=int(input())

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

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

Submission status: Wrong Answer

Solution code:
import math

N=int(input())

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

for i in range(a,((N+1)//2+1)):
  if N%i==0:
    r=N//i
    print(max(len(str(i)),len(str(r))))
    exit()

Submission status: Wrong Answer

Solution code:
import math

N=int(input())

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

for i in range(a,(N+1)//2):
  if N%i==0:
    r=N//i
    print(max(len(str(i)),len(str(r))))
    exit()