Statistics

Problem Statement for "IndictDates"

Problem Statement

In some of the old historical chronicles the Indict system of chronology was used. Instead of a year, this system uses three integers, called indict, circle to the Sun, and circle to the Moon. Let's denote them as indict, circleSun, circleMoon.

Each of these three integers has a unique range. indict is between 1 and 15, circleSun is between 1 and 28, and circleMoon is between 1 and 19 (all ranges are inclusive). Initially, at year 1, all three of these numbers are equal to 1. Every year, all three numbers increase by 1, and whenever a number exceeds its upper bound (15, 28, and 19, respectively), it is reset to 1. For example, in year 16, indict = 1, circleSun = 16, and circleMoon = 16.

Given the ints indict, circleSun, and circleMoon, return the earliest year that the three numbers can represent. Time starts at year 1, so the return value will never be less than 1.

Definition

Class:
IndictDates
Method:
getYear
Parameters:
int, int, int
Returns:
int
Method signature:
int getYear(int indict, int circleSun, int circleMoon)
(be sure your method is public)

Constraints

  • indict will be between 1 and 15, inclusive.
  • circleSun will be between 1 and 28, inclusive.
  • circleMoon will be between 1 and 19, inclusive.

Examples

  1. 1

    16

    16

    Returns: 16

    This is the example from the problem statement.

  2. 1

    1

    1

    Returns: 1

    Initially we are at year 1.

  3. 1

    2

    3

    Returns: 5266

  4. 7

    8

    9

    Returns: 5272

  5. 15

    28

    19

    Returns: 7980

  6. 14

    27

    18

    Returns: 7979

  7. 15

    28

    18

    Returns: 3780

  8. 15

    28

    1

    Returns: 4200

  9. 14

    28

    19

    Returns: 1064

  10. 14

    28

    1

    Returns: 5264

  11. 5

    1

    19

    Returns: 7505

  12. 3

    1

    4

    Returns: 2493

  13. 14

    12

    11

    Returns: 1664

  14. 15

    15

    15

    Returns: 15

  15. 1

    1

    2

    Returns: 4201

  16. 1

    2

    1

    Returns: 4846

  17. 2

    1

    1

    Returns: 6917

  18. 15

    16

    17

    Returns: 5280

  19. 5

    3

    1

    Returns: 5435

  20. 2

    8

    2

    Returns: 5132

  21. 15

    15

    15

    Returns: 15


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: