HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Recursion > problem:


50381 - Sum of the numbers

Guest
• Review clarifications (1)

Section problems

• 50723 - Tribonacci
• 50370 - Number of rectangles in a ...
• 50475 - Voice advertising
• 50909 - Gold Coins
• 50376 - Sequences
• 50725 - Fibonacci Series
• 50385 - The 3n + 1 problem
• 50911 - Symmetric Array
• 50381 - Sum of the numbers
• 50389 - Reverse an Array
• 50727 - Fibonacci Numbers
• 50415 - The Scientist
• 50421 - Repairing road segments
• 50935 - Max Discount
• 50724 - Number of Circles
• 50729 - Max number in 2D array
• 51081 - Fish Pond I

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

Question:
You will be given n numbers. Calculate sum of the numbers in the positions from a to b.

Input specification
You will be given three numbers (n, a and b) then in the following n lines, you will be given n numbers which are between -10000 and 10000 where n is between 1 and 10000 and 1 ≤ a ≤ b ≤ n.
Note: Assume that the number positions are from 1 to n.

Output specification
In the first line, show the sum of the numbers from a to b. That will be followed by the numbers in the positions from a to b.

Sample Input I   
  8 7 8
  -2 3 3 6 5 9 9 -7
Sample Input II   
  10 3 5
  5 -7 3 4 5 6 7 -8 2 9
Sample Output I   
  2
  9 -7
Sample Output II   
  12
  3 4 5


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

www.contester.ru