Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Prepared by Ibrahim Mesecan.
Sum of the Numbers in the given Positions
Question: Write a program that
calculates sum of the numbers in the given positions.
Input specification
There will be 4 lines of data. You will be first given the size of the positions array (n). Then, the following line will have n integers
which is an ordered list in increasing order and 0 < n ≤ 3000. The third line will give the size of the number array (m)
where 0 < m ≤ 5000 and The last line will have m integers between -30000 and 30000.
Note: The positions start from 1 and goes until m.
Output specification
Show one integer number: Sum of the Numbers in the given Positions.
Sample Input I
5
2 5 7 9 10
10
1 8 7 5 17 15 6 7 19 12
|
Sample Output I
62
|
Для отправки решений необходимо выполнить вход.
|