HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Arithmetic > problem:


51033 - Sum of the series

Guest
• Review clarifications (1)

Section problems

• 50659 - Covariance Matrix
• El Clasico
• 50657 - Permutations and Combinat...
• 50658 - The Message
• 50916 - Ascending Numbers
• 50917 - Descending Numbers
• 51029 - Buy Three Items
• 51032 - Triangle Property
• 51033 - Sum of the series
• 51027 - Download Percentage
• 51028 - Isosceles Triangles
• 51031 - Convert from Hex to Dec
• 51030 - Number of Right Triangles
• 50553 - Divisible by m
• 50554 - nth power of m
• 50557 - nth Power of m (Long Multiply)
• 50559 - Prime Factors of a Number

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