Statistics

Problem Statement for "XYZCoder"

Problem Statement

You are going to take part in a popular online programming contest. During the contest the contestants will be split across room rooms, with exactly size contestants in each room. (Hence, there will be exactly room*size contestants.) The rooms will be numbered from 1 to room.

The contest is such that there will be no ties. After the contest, each contestant will have a distinct rank between 1 and room*size, inclusive. (The contestant with rank 1 is the winner.)

A room winner is the contestant with the best (i.e., smallest) rank in their room.

You are interested in the ranks of all room winners. Once the contest finishes, you will write down a sequence of room positive integers. For each i, the i-th element of this sequence will be the rank of the winner of room i.

You are given the ints room and size. Let L be the number of different sequences you can possibly obtain. Compute and return the value (L modulo 1,000,000,007).

Definition

Class:
XYZCoder
Method:
countWays
Parameters:
int, int
Returns:
int
Method signature:
int countWays(int room, int size)
(be sure your method is public)

Constraints

  • room will be between 1 and 100, inclusive.
  • size will be between 1 and 100, inclusive.

Examples

  1. 2

    1

    Returns: 2

    There are 2 rooms, each with 1 contestant. If contestant in room 1 wins the contest, you will write down the list {1,2}. Otherwise, you will write down the list {2,1}. Note that these are considered to be two distinct sequences.

  2. 1

    2

    Returns: 1

    There is 1 room with 2 contestants. Regardless of which of them wins, the winner of the only room will have rank 1, so you will write down the list {1}.

  3. 2

    2

    Returns: 4

    Now we have 2 rooms, each with 2 contestants. In this case you will write down one of the following four lists: {1,2}, {2,1}, {1,3}, or {3,1}. Note the following: You will never write down the list {2,3}, because the winner of the entire contest (rank 1) has to be the winner of one of the rooms. You will never write down the list {1,4}, because the contestant with rank 4 cannot be a room winner in this setting.

  4. 4

    5

    Returns: 6840

  5. 100

    100

    Returns: 718243627

  6. 55

    96

    Returns: 271394236

  7. 29

    85

    Returns: 186283699

  8. 29

    100

    Returns: 884148227

  9. 92

    83

    Returns: 78404347

  10. 83

    71

    Returns: 127505228

  11. 19

    46

    Returns: 709848259

  12. 23

    15

    Returns: 154577394

  13. 49

    49

    Returns: 827095815

  14. 62

    42

    Returns: 17280594

  15. 41

    54

    Returns: 422877699

  16. 34

    23

    Returns: 598119987

  17. 4

    9

    Returns: 42840

  18. 79

    7

    Returns: 418870014

  19. 33

    72

    Returns: 172932139

  20. 66

    97

    Returns: 714389422

  21. 62

    16

    Returns: 866154756

  22. 94

    6

    Returns: 308906022

  23. 62

    7

    Returns: 186334570

  24. 73

    70

    Returns: 497002066

  25. 1

    73

    Returns: 1

  26. 51

    26

    Returns: 739203971

  27. 84

    16

    Returns: 434079293

  28. 74

    29

    Returns: 12942240

  29. 2

    58

    Returns: 116

  30. 64

    32

    Returns: 34205287

  31. 1

    59

    Returns: 1

  32. 92

    83

    Returns: 78404347

  33. 44

    79

    Returns: 157109850

  34. 81

    99

    Returns: 640894437

  35. 59

    25

    Returns: 711410043

  36. 10

    91

    Returns: 217459910

  37. 24

    35

    Returns: 161911161

  38. 16

    9

    Returns: 440660168

  39. 65

    54

    Returns: 481427123

  40. 77

    39

    Returns: 317353169

  41. 97

    81

    Returns: 49314584

  42. 24

    33

    Returns: 927344964

  43. 14

    32

    Returns: 278794421

  44. 25

    80

    Returns: 284832361

  45. 22

    34

    Returns: 274986521

  46. 89

    90

    Returns: 509687471


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: