HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


50380 - Sum of the Numbers in the given Positions

Guest
• Review clarifications (1)

Section problems

• 51165 Question 1
• 51175 Question 2
• 51092 - Even and Odd
• 51095 - Normal and Trace
• 50423 - Numbers square
• 50300 - Matrix
• 50319 - Toll Plazas
• 50977 - Gaussian Elimination
• 50380 - Sum of the Numbers in ...
• 50318 - Product Info
• 50326 - Matrix Operations
• 50395 - Page "Like" Averages
• 50410 - Zero Padding
• 50329 - Draw Matrix-1
• 50337 - Exam Averages
• 50334 - What is the class average?
• 50383 - Noisy Mornings

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