List Indexing - 3
Given
N numbers, and an index, write a program to store the numbers in a list and print the number at given index. For this problem, each input will contain T testcases. Each testcase will give an index Ki as input, which should be considered to print the number.
Input
The first line of input is an integer
N. The second line of input is an integer T representing the number of testcases. The next N lines contain integers representing the numbers of the list. The next T lines contain integer Ki for each line.
Output
You need to print a number in a new line for each of the
K testcases.
Explanation
In the given example, we are given
4 numbers 1, 2, 3, 4 as input For the first testcase, K=0, the number at 0th index is 1. For the second testcase, K=3, the number at 3rd index is 4. So, the output should be
1
4
Sample Input 1
4
2
1
2
3
4
0
3
Sample Output 1
1
4
Sample Input 2
3
1
13
21
19
0
Sample Output 2
13
Comments
Leave a comment