2 Keys Keyboard
면접 대비시간 제한1초메모리 제한1024 MB
화면에 A가 하나 있는 상태에서 전체 복사와 붙여넣기만 사용해 정확히 N개의 A를 만드는 최소 연산 횟수를 구한다.
문제
Imagine a very simple text editor that supports exactly two operations:
- Copy All : Copy the entire current screen content into the clipboard. (Partial copy is not allowed.)
- Paste : Paste the content from the clipboard onto the screen.
Initially, the screen contains a single character A. Your goal is to display exactly characters A on the screen using the minimum number of operations possible. Find the minimum number of operations required when acting optimally.
입력
The first line contains a single integer , representing the number of characters A to be displayed.
출력
Print a single integer: the minimum number of operations required.