Aunty Khong is organising a competition with
Each of Aunty Khong's bags will contain zero or more biscuits of each type. The total number of biscuits of type
Help Aunty Khong find out how many different values of
Implementation details
You should implement the following procedure:
long long count_tastiness(long long x, std::vector<long long> a)
: the number of bags of biscuits to pack. : an array of length . For , denotes the number of biscuits of type in the pantry.- The procedure should return the number of different values of
, such that Aunty can pack bags of biscuits, each one having a total tastiness of . - The procedure is called a total of
times (see Constraints and Subtasks sections for the allowed values of ). Each of these calls should be treated as a separate scenario.
Examples
Example 1
Consider the following call:
count_tastiness(3, {5, 2, 1})
This means that Aunty wants to pack
biscuits of type , each having a tastiness value , biscuits of type , each having a tastiness value , biscuit of type , having a tastiness value .
The possible values of
- one bag containing three biscuits of type
, and - two bags, each containing one biscuit of type
and one biscuit of type .
Since there are
Example 2
Consider the following call:
count_tastiness(2, {2, 1, 2})
This means that Aunty wants to pack
biscuits of type , each having a tastiness value , biscuit of type , having a tastiness value , biscuits of type , each having a tastiness value .
The possible values of
Constraints
(for all )- For each call to
count_tastiness
, the sum of tastiness values of all biscuits in the pantry does not exceed .
Subtasks
- (
points) , and for each call tocount_tastiness
, the sum of tastiness values of all biscuits in the pantry does not exceed . - (
points) - (
points) - (
points) The correct return value of each call tocount_tastiness
does not exceed . - (
points) No additional constraints.
Sample grader
The sample grader reads the input in the following format. The first line contains an integer
- line
: - line
:
The output of the sample grader is in the following format:
- line
: return value ofcount_tastiness
for the -th scenario in the input.
Comments