Universal Cup Judging System

Universal Cup

Süre Sınırı: 1.0 s Bellek Sınırı: 1024 MB Toplam puan: 100
İstatistikler

John はセキュリティを非常に重視しているため、彼のパスワードはとても長く、$n$ 文字あります。しかし、彼はあまり創造的ではないため、パスワードのすべての文字は同じ文字、すなわち英小文字 a です。John はとてもせっかちなので、できるだけ速くパスワードを入力したいと考えています。

彼はちょうど $n$ 個の文字 a からなる文字列を得たいです。彼は次の操作の列を使うことができます:「a」(文字 a を入力する)、「Ctrl-A」(すべて選択する)、「Ctrl-C」(クリップボードにコピーする)、「Ctrl-V」(クリップボードから貼り付ける)。パスワード入力欄とクリップボードがともに空の状態から始めたとき、目的の結果を得るために必要な最小の操作回数はいくつでしょうか?

以下は、John がパスワード入力欄で行える 4 つの操作の厳密な定義です:

  • 「a」を押す:テキストが選択されていない場合、カーソルの位置(その左側)に文字 a を挿入する。そうでない場合、選択されているテキストを文字 a で置き換える。その後、テキストは何も選択されていない状態になり、カーソルはパスワード入力欄の末尾に移動する。
  • 「Ctrl-A」を押す:パスワード入力欄内のすべてのテキストを選択する。
  • 「Ctrl-C」を押す:テキストが選択されていない場合、何もしない。そうでない場合、選択されているテキストをクリップボードにコピーする。
  • 「Ctrl-V」を押す:クリップボードが空の場合、何もしない。そうでない場合、テキストが選択されていなければ、クリップボードのテキストをカーソルの位置(その左側)に挿入し、選択されていれば、選択されているテキストをクリップボードのテキストで置き換える。最後に、テキストは何も選択されていない状態になり、カーソルはパスワード入力欄の末尾に移動する。クリップボードの内容は変化しない。

入力

入力の 1 行目(唯一の行)には、目的のパスワードの長さを表す 1 つの整数 $n$($1 \le n \le 10^{12}$)が与えられます。

出力

目的の長さのパスワードを入力するために必要な最小の操作回数を表す 1 つの整数を出力してください。

入出力例

入力例 1

11

出力例 1

10

注記

John は次の操作列を使うことができます:a, a, Ctrl-A, Ctrl-C, Ctrl-V, Ctrl-V, Ctrl-V, Ctrl-V, Ctrl-V, a。

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1051EditorialOpen题解jianglyView

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.