Life of an Amoeba
All submissions for this problem are available.
Chef is a student of Biology. He has been given an assignment, he was given an amoeba to observe. Chef was supposed to study the pattern of its cell division and report the total number of cells that were under observation after M days. Chef was given enough time to complete his assignment, but he remembered it only on the day when it was his deadline. Chef got some data from one of his seniors regarding the category of amoeba that was given to him. He gave chef a sequence of N numbers, the ith number represented the number of cells the amoeba(s) of ith generation would divide themselves into. The senior student also told him that the amoebas take X days to divide.
You can help him complete his assignment. Find the number of amoebas present on the Mth days.
The first line of input contains T, the number of test cases. The first line of each test case contains three space separated integers N, X, M. The next line contains N space separated integers which is the sequence of N numbers given to chef by his senior.
For each test case output the number of amoebas left.
Should contain all the constraints on the input data that you may have. Format it like:
- 1 ≤ T ≤ 100
- 1 ≤ N ≤ 100
- 1 ≤ X ≤ 100
- 1 ≤ M ≤ N
Input: 2 5 1 1 2 3 2 5 4 5 2 3 2 3 2 5 4 Output: 1 2
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6|
Fetching successful submissions
If you are still having problems, see a sample solution here.