問題一覧 > 通常問題

No.555 World History Report

レベル : / AI推定難易度 : 950 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 180
作問者 : addeight2 / テスター : butsurizuki
お気に入りにしたユーザー ProblemId : 1305 / 自分の提出
問題文最終更新日: 2026-06-25 19:08:31
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 171 (順位表) の他の問題:

Problem Statement

addeight is a high school student.
He is now writing a world history report on his computer.
However, he is bad at world history, and so far the report contains only the letter A.
If the report does not contain at least \(N\) characters, the scary world history teacher will get angry at him.
So, addeight decided to create a string of at least \(N\) characters using only copy and paste.
Copying copies the entire string of the report to the clipboard, and pasting appends the string in the clipboard to the end of the string of the report.
Copy and paste cost \(C\) and \(V\), respectively. Find the minimum cost to create at least \(N\) characters.

The clipboard is initially an empty string.

Input

N
C V

\(2 \leq N \leq 50000\)
\(1 \leq C , V \leq 1000\)

Output

Output the minimum cost required to create at least \(N\) characters.
Print a newline at the end.

Sample

Sample 1
Input
6
3 2
Output
12

OperationString in the reportString in the clipboard
Initial stateA
CopyAA
PasteAAA
CopyAAAA
PasteAAAAAA
PasteAAAAAAAA
Copy was performed 2 times and paste 3 times, so the total cost is 12. Also, the sequence copy, paste, paste, copy, paste can create 6 characters at a cost of 12 as well.

Sample 2
Input
10
1 3
Output
15

The sequence copy, paste, copy, paste, copy, paste, paste creates 12 characters at a cost of 15. There are also other ways to create at least 10 characters at a cost of 15.

Sample 3
Input
100
1000 1
Output
1099

Copy once, then paste 99 times.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。