Problem C
Cheats
Cosmo is busy playing the little-known latest installment in
the Legend of Zelda series of video games, Skyward Wind Mask of
Twilight Time. In this game, the player must complete all
Like all games, however, this game has hidden cheats. There
is one cheat for each objective
Cosmo would like to complete the game while exploiting at
most
Input
There will be up to 150 test cases in the input. Each test
case will begin with two integers
Output
For each test case, output a single integer, which indicates
the number of ways Cosmo can achieve all
Explanation of Sample Input/Output
This table lists all of the orders in which Cosmo can achieve all of the objectives for the Sample Input/Output using at most one cheat.
No Cheats | 2's Cheat | 3's Cheat | 4's Cheat | 5's Cheat -------------+------------+------------+------------+----------- 1 2 3 5 4 | 2 1 3 5 4 | 3 1 2 5 4 | 1 2 3 4 5 | 5 1 2 3 4 1 2 5 3 4 | 2 1 5 3 4 | 3 1 5 2 4 | 1 2 4 3 5 | 5 1 2 4 3 1 2 5 4 3 | 2 1 3 4 5 | 3 1 5 4 2 | 1 2 4 5 3 | 5 1 3 2 4 1 3 2 5 4 | | | 1 3 2 4 5 | 5 1 3 4 2 1 3 5 2 4 | | | 1 3 4 2 5 | 5 1 4 2 3 1 3 5 4 2 | | | 1 3 4 5 2 | 5 1 4 3 2 1 5 2 3 4 | | | 1 4 2 3 5 | 5 4 1 2 3 1 5 2 4 3 | | | 1 4 2 5 3 | 5 4 1 3 2 1 5 3 2 4 | | | 1 4 3 2 5 | 1 5 3 4 2 | | | 1 4 3 5 2 | 1 5 4 2 3 | | | 1 4 5 2 3 | 1 5 4 3 2 | | | 1 4 5 3 2 |
Sample Input 1 | Sample Output 1 |
---|---|
5 1 1 1 5 1 0 0 |
38 |