Statistics

Problem Statement for "EmoticonsDiv2"

Problem Statement

You are very happy because you advanced to the next round of a very important programming contest. You want your best friend to know how happy you are. Therefore, you are going to send him a lot of smile emoticons. You are given an int smiles: the exact number of emoticons you want to send.

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:
  1. Copy all the emoticons you currently have into the clipboard.
  2. Paste all emoticons from the clipboard.
Each operation takes precisely one second. Copying replaces the old content of the clipboard. Pasting does not empty the clipboard. Note that you are not allowed to copy just a part of the emoticons you already have.

Return the smallest number of seconds in which you can turn the one initial emoticon into smiles emoticons.

Definition

Class:
EmoticonsDiv2
Method:
printSmiles
Parameters:
int
Returns:
int
Method signature:
int printSmiles(int smiles)
(be sure your method is public)

Constraints

  • smiles will be between 2 and 1000, inclusive.

Examples

  1. 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.

  2. 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.

  3. 11

    Returns: 11

  4. 16

    Returns: 8

  5. 1000

    Returns: 21

  6. 3

    Returns: 3

  7. 4

    Returns: 4

  8. 5

    Returns: 5

  9. 7

    Returns: 7

  10. 8

    Returns: 6

  11. 9

    Returns: 6

  12. 11

    Returns: 11

  13. 12

    Returns: 7

  14. 13

    Returns: 13

  15. 99

    Returns: 17

  16. 14

    Returns: 9

  17. 15

    Returns: 8

  18. 17

    Returns: 17

  19. 21

    Returns: 10

  20. 24

    Returns: 9

  21. 29

    Returns: 29

  22. 31

    Returns: 31

  23. 32

    Returns: 10

  24. 33

    Returns: 14

  25. 87

    Returns: 32

  26. 93

    Returns: 34

  27. 101

    Returns: 101

  28. 123

    Returns: 44

  29. 321

    Returns: 110

  30. 254

    Returns: 129

  31. 255

    Returns: 25

  32. 256

    Returns: 16

  33. 257

    Returns: 257

  34. 300

    Returns: 17

  35. 343

    Returns: 21

  36. 400

    Returns: 18

  37. 500

    Returns: 19

  38. 601

    Returns: 601

  39. 699

    Returns: 236

  40. 765

    Returns: 28

  41. 897

    Returns: 39

  42. 893

    Returns: 66

  43. 901

    Returns: 70

  44. 989

    Returns: 66

  45. 990

    Returns: 24

  46. 991

    Returns: 991

  47. 992

    Returns: 41

  48. 993

    Returns: 334

  49. 994

    Returns: 80

  50. 995

    Returns: 204

  51. 996

    Returns: 90

  52. 997

    Returns: 997

  53. 998

    Returns: 501

  54. 999

    Returns: 46

  55. 971

    Returns: 971

  56. 125

    Returns: 15

  57. 955

    Returns: 196

  58. 53

    Returns: 53

  59. 49

    Returns: 14

  60. 333

    Returns: 43

  61. 37

    Returns: 37


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: