EmoticonsDiv2
SRM 612 · 2013-12-22 · by ltaravilse
Problem Statement
You have already typed one emoticon into the chat. Then, you realized that typing is slow. Instead, you will produce the remaining emoticons using copy and paste.
You can only do two different operations:
- Copy all the emoticons you currently have into the clipboard.
- Paste all emoticons from the clipboard.
Return the smallest number of seconds in which you can turn the one initial emoticon into smiles emoticons.
Constraints
- smiles will be between 2 and 1000, inclusive.
Statement by TopCoder, Inc. — view the original on the archive.
2 Returns: 2
First use copy, then use paste. The first operation copies one emoticon into the clipboard, the second operation pastes it into the message, so now you have two emoticons and you are done.
6 Returns: 5
Copy. This puts one emoticon into the clipboard. Paste. You now have 2 emoticons in the message. Copy. The clipboard now contains 2 emoticons. Paste. You now have 4 emoticons in the message. Paste. You now have 6 emoticons in the message and you are done.
11 Returns: 11
16 Returns: 8
1000 Returns: 21
Submissions are judged against all 61 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class EmoticonsDiv2 with a public method int printSmiles(int smiles) · 61 test cases · 2 s / 256 MB per case