ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Задачи со всего света > задача:


090. 50378 - Sum of the given digits

Гость
• Вопросы к жюри (1)

Задачи сборника

• 050. 50566 - Mesatarja e pikeve te ...
• 060. 50727 - Fibonacci Numbers
• 061. 50733 - The Highest Average
• 062. 50390 - Total Salary Paid
• 066. 50523 - Total Tax to Pay
• 070. 50534 - Top Trading Company
• 076. 50289 - Monthly Allowance
• 080. 50347 - Selling Oranges
• 090. 50378 - Sum of the given d...
• 095. 50453 - The Cubic Difference
• 100. 50397 - The Number of Points ...
• 110. 50409 - Random Password Ge...
• 120. 50684 - Shuma e numrave pri...
• 125. 50578 - Numrat Prim Mersenne
• 130. 50652 - Faktorizimi ne numra prim
• 132. 50474 - Sum of Two Primes
• 135. 50572 - Numrat Palindrome

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
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