Submit | All submissions | Best solutions | Back to list |
PRADIPSUM - Easy Math |
Zoro is a student of a primary school. He likes to solve mathematical problem. One day he tries to solve a math, but he is unable to solve the problem efficiently because of being a student of primary school. As you are a programmer he wants your help to solve this problem. The problem is to find the sum of some consecutive numbers.
Example, if the first number is 2 and the last number is 5, then the result would be
2 + 3 + 4 + 5 = 14
Input
Every line contains two integers a and b. Input is terminated by the end of file.
Output
Output the sum the of all numbers between a and b (inclusively).
Constraints
-108 ≤ (a , b) ≤ 108
Example
Input: 2 5 5 10 Output: 14 45
Added by: | Nabil |
Date: | 2018-09-26 |
Time limit: | 2s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
hide comments
|
|||||
2021-03-01 14:17:41 majid
"Output the sum the of all numbers" Funny!! |
|||||
2020-09-04 01:10:18 Pranay
use long long |
|||||
2019-11-09 19:32:10
why time limit exceeded occurs again & again? |
|||||
2019-11-09 19:21:41
Notice the input's position. Also this should be moved to the tutorial section. Last edit: 2019-11-09 19:22:01 |
|||||
2019-08-08 03:22:41
Should be moved to tutorials. |
|||||
2019-04-19 18:21:06
@prachij while true, try: s=input() and then except EOFError: break |
|||||
2018-10-20 17:42:40 Kanish_The_Vista
This should be moved to tutorial section Last edit: 2018-10-20 17:43:42 |
|||||
2018-10-19 15:42:55
How to make the "Input is terminated by (end of file)" in python3 Please help. |
|||||
2018-10-17 03:34:59
This should be moved to tutorial... Last edit: 2018-10-17 03:38:39 |
|||||
2018-10-09 15:27:01
you are welcome :) |