HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN111 Homeworks 2013-2015 > problem:


50378 - Sum of the given digits

CEN111 Homeworks 2013-2015

Start: Jan.10.2015 at 10:00:00 AM
Finish: Jan.10.2015 at 03:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 50389 - Reverse an Array
• 50392 - How much space
• 50378 - Sum of the given digits
• 13-Fall2-10. 50379 - a^b modulus k
• 13-Fall2-20. 50399 - Mobile Base Sta...
• 13-Fall2-40. 50401 - Sum of Odd N...
• 13-Fall2-50. 50400 - nth Row rth El...
• 14-Fall1-10. 50532 - Close City
• 14-Fall1-30. 50500 - Find Student
• 14-Fall1-40. 50511 - Class Average
• 14-Fall1-50. 50481 - Car Parking

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.
Question by Ibrahim Mesecan.

Sum of the given digits

You are given some numbers and certain digit numbers. Calculate and show the sum of given digits.

Input specification
You will be given a number (n) first where 1 ≤ n ≤ 100. Then, in the following n lines, you will be given a number which is followed by unknown number of numbers (digits) where each of the digit is between 1 and 9 and the digits end with a -1. Calculate and show sum of the given digits for each number. Note that the numbering of the digits starts from the end.

Output specification
Show sum of given digits for every number in a line


Sample Input
3
6447 2 4 -1
38455 1 4 5 -1
76 1 -1
 Sample Output  
10
16
6

Explanation: For the first number, second digit is 4 and the fourth digit is 6, thus result is 10. For the second number, the first, fourth, and the fifth digits (5, 8 and 3) are asked which makes 16.


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

www.contester.ru