HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Beginners > problem:


51033 - Sum of the series

Guest
• Review clarifications (1)

Volume problems

• 51007 - Function f(x)
• 50481 - Car Parking
• 50480 - What quadrant is it?
• 50482 - Bank Charges
• 50430 - ATM
• 51029 - Buy Three Items
• 51034 - Area of 3 Shapes
• 51032 - Triangle Property
• 51033 - Sum of the series
• 51027 - Download Percentage
• 51028 - Isosceles Triangles
• 50799 - OSHEE Electric Bill
• 51031 - Convert from Hex to Dec
• 51030 - Number of Right Triangles
• 005. 50797 - Nr of Missing Guests
• 007. 50280 - Division
• 028. 50521 - Pound to Grams

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 series

Question: In mathematics, sum of the series from 1 to n can be calculated by Equation 1.

From this formula sum of the numbers from a to b can be derived as in Equation 2. Write a program that is going to get two numbers a and b, then the program is going to calculate sum of the series from a to b.

Input specification: You will be given 2 integers (a and b) where 0 ≤ (a and b) ≤ 50,000.

Output specification: Show one number, sum of the numbers from a to b.

Sample Input I
5 10
Sample Input II
1 10000
Sample Output I
45
Sample Output II
50005000

Explanation: To calculate sum of the numbers from 5 to 10, first sum of the numbers from 1 to 10 (55) and sum of the numbers from 1 to 4 (10) are calculated.
Then, 55 - 10 = 45.

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

www.contester.ru