HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50380 - Sum of the Numbers in the given Positions

Guest
• Review clarifications (1)

Volume problems

• 250. 50448 - Paint Buckets
• 280. 50477 - Character Pyramids
• 50304 - Number Pattern
• 50492 - Contest Scoreboard
• 50322 - Snake Pattern
• 50321 - Missing Number
• 50445 - Cryptography
• 50410 - Zero Padding
• 50380 - Sum of the Numbers in ...
• 50400 - nth Row rth Element of a Table
• 50457 - The Number of Winners
• 50585 - Inner Product
• 50587 - Modular Conversion
• 030. 50737 - Sum of the k-largest n...
• 50419 - The longest bitonic sequence
• 50317 - Student Line Up
• 50311 - Student Line Up

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
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


Для отправки решений необходимо выполнить вход.

www.contester.ru