Logo
(追記) (追記ここまで)

24555번 - 1’s For All 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
15 초 (추가 시간 없음) 1024 MB173412921.805%

문제

The complexity of an integer is the minimum number of 1ドル$'s needed to represent it using only addition, multiplication and parentheses. For example, the complexity of 2ドル$ is 2ドル$ (writing 2ドル$ as 1ドル+1$) and the complexity of 12ドル$ is 7ドル$ (writing 12ドル$ as $(1+1+1)\times (1+1+1+1)$). We'll modify this definition slightly to allow the concatenation operation as well. This operation (which we'll represent using ©) takes two integers and "glues" them together, so 12ドル\ $©$\ 34$ becomes the four digit number 1234ドル$. Using this operation, the complexity of 12ドル$ is now 3ドル$ (writing it either as $(1 \ $©$\ 1) + 1$ or 1ドル\ $©$\ (1+1)$). Note that the concatenation operation ignores any initial zeroes in the second operand: 1ドル\ $©$\ 01$ does not result in 101ドル$ but results in 11ドル$.

We'll give you 1ドル$ guess what the object of this problem is.

입력

Each test case consists of a single line containing an integer $n,ドル where 0ドル < n \leq 100,円 000$.

출력

Output the complexity of the number, using the revised definition above.

제한

예제 입력 1

2

예제 출력 1

2

예제 입력 2

12

예제 출력 2

3

힌트

출처

ICPC > Regionals > North America > East Central North America Regional > 2021 East Central Regional Contest A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /