Problem Statement
Initially the cylinder is empty. Return the number of different ways to push N Puyos into the cylinder, so that the cylinder becomes empty after the pushes, modulo 1,000,000,007.
Definition
- Class:
- PuyoPuyo
- Method:
- theCount
- Parameters:
- int, int
- Returns:
- int
- Method signature:
- int theCount(int L, int N)
- (be sure your method is public)
Notes
- Two ways are different if there exists an i such that i-th pushed ball is different in one way than it is in the other.
Constraints
- L will be between 2 and 10, inclusive.
- N will be between 1 and 1000, inclusive.
Examples
2
2
Returns: 4
He must push the same type of Puyos twice.
2
4
Returns: 28
There are 4 ways to push Puyos of the form "XXXX". There are 12 ways to push Puyos of the form "XXYY". There are 12 ways to push Puyos of the form "XYYX". In this case, the cylinder changes as follows: (right represents the top of the cylinder) "" (initially the cylinder is empty) "X" (push X-type Puyo) "XY" (push Y-type Puyo) "XYY" (push Y-type Puyo) "X" (two topmost Y-type Puyos disappear) "XX" (push X-type Puyo) "" (two topmost X-type Puyos disappear) In total, there are 4 + 12 + 12 = 28 ways.
2
58
Returns: 868294620
4
84
Returns: 621871151
5
8
Returns: 0
2
1000
Returns: 36859875
2
998
Returns: 30389435
3
3
Returns: 4
3
6
Returns: 40
3
999
Returns: 86778821
3
996
Returns: 463701982
4
4
Returns: 4
4
8
Returns: 52
4
1000
Returns: 148756394
4
996
Returns: 232660629
5
5
Returns: 4
5
10
Returns: 64
5
1000
Returns: 289673403
5
995
Returns: 923075924
6
6
Returns: 4
6
12
Returns: 76
6
996
Returns: 487966164
6
990
Returns: 269862352
7
7
Returns: 4
7
14
Returns: 88
7
994
Returns: 819953526
7
987
Returns: 37905267
8
8
Returns: 4
8
16
Returns: 100
8
1000
Returns: 163819294
8
992
Returns: 124458741
9
9
Returns: 4
9
18
Returns: 112
9
999
Returns: 681002927
9
990
Returns: 722331324
10
10
Returns: 4
10
20
Returns: 124
10
1000
Returns: 61125483
10
990
Returns: 417012356
7
649
Returns: 0
5
432
Returns: 0
5
38
Returns: 0
7
416
Returns: 0
8
626
Returns: 0
2
647
Returns: 0
7
445
Returns: 0
7
409
Returns: 0
10
762
Returns: 0
8
189
Returns: 0
10
1
Returns: 0
10
999
Returns: 0
10
500
Returns: 306689442
2
50
Returns: 227044376