Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. 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 .
Для отправки решений необходимо выполнить вход.
|