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:
import math
n = int(input())

def order(a,b):
    return max(len(str(int(a))),len(str(int(b))))
    
ans = [] 
numbers = []

for i in range(1,int(math.ceil(math.sqrt(n)))):
    if len(numbers) != 0:
        if i > min(numbers):
            break
    if n % i == 0:
        ans.append(order(n/i,i))
        numbers.append(n/i)
        
if len(ans) == 0:
    print(1)
else:
    print(min(ans))

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
x=math.floor(n)

while 1:
  if n % x ==0:
    break
  x-=1

print(max(len(str(int(n/x))),len(str(x))))

Submission status: Wrong Answer

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

div = 1
max_v = int(sqrt(N))
for num in range(max_v,1,(-1)):
	if N % num == 0:
		div = num
		break

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

Submission status: Wrong Answer

Solution code:
import math

num = int(input())

res = float("inf")
for i in range(1, math.ceil(pow(num, 0.5))):
    if num % i == 0:
        if max(len(str(i)), len(str(int(num/i)))) < res:
            res = max(len(str(i)), len(str(int(num/i))))
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())

x = int(pow(N, 0.5))
for i in range(x, 0, -1):
    if N % i == 0:
        ans = max([str(i), str(N // i)])
        print(len(str(ans)))
        break

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
ans = len(str(n))

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

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
n = int(math.sqrt(N))
if N / n == n:
    print(int(math.log10(n) + 1))
else:
    while N % n != 0:
        n -= 1
    print(int(math.log10(n) + 1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Here your code !
import math;

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

while True:
    b = n // a;
    if n == a * b:
        print("a,b", a, b+1)
        print(int(math.log10(b))+1);
        break
    a = a-1;

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Here your code !
import math;

n = int(input());
a = int(math.sqrt(n));
print("a,n = " , a, n);

while True:
    b = n // a;
    if n == a * b:
        print("a,b", a, b+1)
        print(int(math.log10(b))+1);
        break
    a = a-1;

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Here your code !
import numpy as np
import math as mt
n = int(input())
half = mt.ceil(mt.sqrt(n))
 
while n % half !=0:
    half -= 1
    
 
print(mt.ceil(mt.log(n/half,10)))

Submission status: Wrong Answer

Solution code:
def dig(t):
    res = 0
    
    if t == 0:
        return 1
    
    while t > 0:
        t//=10
        res+=1

    return res

n = int(input())

f = 1000000000

for i in range(n):
    if i*i > n: break
    if i <= 0 or n%i > 0: continue
    
    f = min(f, max(dig(i), dig(n/i)))
    
print(f)

Submission status: Wrong Answer

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

import sys

N = sys.stdin.readline().replace('\n','')
N = int(N)

def Func(a,b):
	if a > b:
		return digit(a)
	else: return digit(b)
		
def digit(num):
	d = len(str(num))
	return d

ans = 10

for i in range(1,N):
	if i*i > N: break
	if N % i == 0:
		dum = Func(N//i,i)
		if ans > dum:
			ans = dum

print(ans)

Submission status: Wrong Answer

Solution code:
import math,sys
N=int( input())
if N==0:
  print(1)
  sys.exit()
for r in range (int(math.sqrt(N)),0,-1):
  if N%r==0:
    count=1
    l=N/r
    for i in range (0,9):
      l=l/10
      if l<1:
        print(count)
        break
      count+=1
    break

Submission status: Wrong Answer

Solution code:
import math
N=int( input())
for r in range (int(math.sqrt(N)),0,-1):
  if N%r==0:
    count=1
    l=N/r
    for i in range (0,9):
      l=l/10
      if l<1:
        print(count)
        break
      count+=1
    break

Submission status: Wrong Answer

Solution code:
import math
N=int( input())
for r in range (int(math.sqrt(N)),N):
  if N%r==0:
    count=1
    for i in range (0,9):
      r=r/10
      if r<1:
        print(count)
        break
      count+=1
    break