Statistics

Problem Statement for "FlatCatsBreeding"

Problem Statement

A flat cat is a fictional Martian animal known for being an extremely affectionate pet and also for being able to replicate itself promptly given favorable conditions. The cat replicates itself when it is D, 2*D, 3*D, ... days old, and each time, it creates K new kittens. You have been presented with a newborn flat cat. Return the number of days after which you will have at least T cats, assuming that cats don't die.

Definition

Class:
FlatCatsBreeding
Method:
days
Parameters:
int, int, int
Returns:
int
Method signature:
int days(int D, int K, int T)
(be sure your method is public)

Constraints

  • D will be between 1 and 100, inclusive.
  • K will be between 1 and 10, inclusive.
  • T will be between 1 and 1000000, inclusive.

Examples

  1. 4

    3

    1

    Returns: 0

    You have one cat as soon as you are presented with it, so you don't have to wait until it replicates.

  2. 4

    3

    4

    Returns: 4

    After 4 days, the first cat produces 3 kittens, so you will have a total of 4 cats.

  3. 4

    3

    9

    Returns: 8

    After 4 days, you'll have four cats. After 4 more days, each of those cats will produce 3 kittens, for a total of 16 cats. Note that you don't need to have exactly T cats, but at least T.

  4. 4

    3

    1000000

    Returns: 40

  5. 100

    1

    1000000

    Returns: 2000

    max test

  6. 1

    10

    1

    Returns: 0

    #5-6 is "need minimal number of cats"

  7. 45

    8

    1

    Returns: 0

  8. 1

    5

    978235

    Returns: 8

    #7 is "cats breed each day"

  9. 84

    1

    234987

    Returns: 1512

    #8-9 is "1 kitten each time"

  10. 34

    1

    978325

    Returns: 680

  11. 27

    6

    12088

    Returns: 135

  12. 59

    7

    2170

    Returns: 236

  13. 91

    6

    10433

    Returns: 455

  14. 93

    1

    24671

    Returns: 1395

  15. 9

    7

    17079

    Returns: 45

  16. 42

    9

    11216

    Returns: 210

  17. 86

    1

    19321

    Returns: 1290

  18. 83

    7

    30526

    Returns: 415

  19. 57

    8

    4211

    Returns: 228

  20. 57

    9

    5548

    Returns: 228

  21. 49

    7

    4196

    Returns: 245

  22. 37

    8

    6685

    Returns: 185

  23. 61

    5

    3132

    Returns: 305

  24. 32

    6

    11946

    Returns: 160

  25. 3

    2

    25416

    Returns: 30

  26. 52

    3

    31182

    Returns: 416

  27. 90

    2

    28042

    Returns: 900

  28. 2

    4

    13237

    Returns: 12

  29. 79

    4

    10094

    Returns: 474

  30. 77

    4

    4229

    Returns: 462

  31. 16

    9

    3134

    Returns: 64

  32. 67

    8

    2559

    Returns: 268

  33. 38

    1

    258

    Returns: 342

  34. 44

    8

    10733

    Returns: 220

  35. 6

    7

    16297

    Returns: 30

  36. 86

    7

    4147

    Returns: 430

  37. 64

    9

    23223

    Returns: 320

  38. 58

    3

    23167

    Returns: 464

  39. 56

    3

    17355

    Returns: 448

  40. 56

    1

    8426

    Returns: 784

  41. 11

    8

    19376

    Returns: 55

  42. 27

    3

    14863

    Returns: 189

  43. 76

    4

    26846

    Returns: 532

  44. 26

    3

    14941

    Returns: 182

  45. 15

    2

    16796

    Returns: 135

  46. 86

    3

    30121

    Returns: 688

  47. 72

    1

    4372

    Returns: 936

  48. 99

    4

    32602

    Returns: 693

  49. 91

    2

    4896

    Returns: 728

  50. 91

    5

    3228

    Returns: 455

  51. 48

    9

    16541

    Returns: 240

  52. 55

    7

    1401

    Returns: 220

  53. 19

    7

    24187

    Returns: 95

  54. 74

    5

    19669

    Returns: 444

  55. 73

    5

    17390

    Returns: 438

  56. 46

    2

    9361

    Returns: 414

  57. 12

    4

    22630

    Returns: 84

  58. 84

    4

    25199

    Returns: 588

  59. 46

    3

    12350

    Returns: 322

  60. 19

    8

    15206

    Returns: 95

  61. 99

    2

    531441

    Returns: 1188

  62. 99

    2

    531442

    Returns: 1287


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: