#P5810. [SCOI2004] 文本的输入

[SCOI2004] 文本的输入

Problem Description

When people input text, besides typing character by character, they can also use the clipboard to copy. Typing one letter takes 11 unit of time. Copying the part that has already been typed into the clipboard takes 55 units of time (Ctrl+A, Ctrl+C, then cancel the select-all state). Pasting the clipboard content takes 22 units of time (Ctrl+V).

If we do not care about the actual content of the text and only care about its length, what is the minimum time needed to input a text whose length is at least nn?

Note: The Constraints are slightly different from the original problem.

Input Format

A positive integer nn, representing the length of the text.

Output Format

A positive integer tt, representing the minimum time needed.

20
16

Hint

Sample explanation: First spend 77 units of time to type 77 characters, then copy (costs 55 units of time), paste twice (costs 44 units of time), and you can type 2121 characters in 1616 units of time.

For 20%20\% of the testdata, n10n\le 10.

For 60%60\% of the testdata, n104n\le 10^4.

For 100%100\% of the testdata, n4×104n\le 4\times 10^4.

Translated by ChatGPT 5