CF986D.Perfect Encoding

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are working as an analyst in a company working on a new system for big data storage. This system will store nn different objects. Each object should have a unique ID.

To create the system, you choose the parameters of the system — integers m1m \ge 1 and b1,b2,,bmb_{1}, b_{2}, \ldots, b_{m} . With these parameters an ID of some object in the system is an array of integers [a1,a2,,am][a_{1}, a_{2}, \ldots, a_{m}] where 1aibi1 \le a_{i} \le b_{i} holds for every 1im1 \le i \le m .

Developers say that production costs are proportional to i=1mbi\sum_{i=1}^{m} b_{i} . You are asked to choose parameters mm and bib_{i} so that the system will be able to assign unique IDs to nn different objects and production costs are minimized. Note that you don't have to use all available IDs.

输入格式

In the only line of input there is one positive integer nn . The length of the decimal representation of nn is no greater than 1.51061.5 \cdot 10^{6} . The integer does not contain leading zeros.

输出格式

Print one number — minimal value of i=1mbi\sum_{i=1}^{m} b_{i} .

输入输出样例

  • 输入#1

    36
    

    输出#1

    10
    
  • 输入#2

    37
    

    输出#2

    11
    
  • 输入#3

    12345678901234567890123456789
    

    输出#3

    177
    
首页