Challenge 11 - All the Possibilities
Some people in the office are thinking about how many possible addition operations can be obtained given a positive number. Taking some considerations like A + B = B + A and only one of them should be summarized. Furthermore, A > 0 && B > 0.
On the first line, an integer T indicates the number of cases. Each case is described on a line with an integer X , which is the value to obtain, and a list of M positive numbers N0, N1... NM-1 separated by an empty space. These values cannot be used to calculate the operations.
For each case T, the output should be the string "Case #t:" followed by the total possible operations. See the example output.
- 1 ≤ T ≤ 100
- 1 ≤ X ≤ 100
- 0 ≤ M ≤ 100
- 1 ≤ N0, N1... NM-1 < 100
2 2 1 5 4 2
Case #1: 0 Case #2: 2
In the first case (2), there are no way to summarize 2 without the operand 1.
The second case (5) can be calculate with the operations 1+3+1 and 1+1+1+1+1, so there are 2 possible operations.
Test your code
You can test your program against both the input provided in the test phase and the input provided in the submit phase. A nice output will tell you if your program got the right solution or not. You can try as many times as you want. Be careful with extra whitespace. The output should be exactly as described.
Test your program against the input provided in the test phase
Test your program against the input provided in the submit phase
During the submit phase, in some problems, we might give your program harder inputs. As with the test token, a nice output will tell you if your program got the right solution or not. You can try as many times as you need.
In the actual contest you have to solve the test phase before you can submit your code. You must provide the source code used to solve the challenge and you can only make one submission. After your solution is submitted, you won't be able to modify it to fix issues or make it faster.
If you have any doubts, please see the info section.