MADODDSUM - Easy Odd Sum
Hablu likes odd numbers a lot. So he wants the sum of all odd numbers in range [a, b]. That is, find the sum of all odd numbers i such that (a ≤ i ≤ b). Seems easy right? Because it is.
Input
The first and only line will contain 2 integers a, b where (0 ≤ a ≤ 108) and (0 ≤ b ≤ 108).
Output
In one line, output the value of the sum
Example
Input: 0 9 Output: 25
hide comments
chetanreddy_v:
2021-01-28 16:29:47
@kass_97 plz help, idk how to use spoj toolkit. i did everything right but its showing wrong
|
|
ayushagarwal1:
2020-10-01 09:31:34
this is addition of two large integer sum.BIG INTEGER WILL BE USED. |
|
yashika_789:
2020-06-22 19:43:47
ac in one go!! use unsigned long long int and take range(a,b] |
|
aticina:
2020-01-23 18:16:08
I am not sure what SPOJ is trying to tell me,I see it find error of some kind,even thou I believe that code works-but works for me,on my computer-when I submit it it says error and details reveal this:
|
|
karankeswani99:
2018-12-19 10:29:59
very simple!!! |
|
arunsriram1155:
2018-08-22 07:11:39
yes the range should be (a,b]. the question is wrong ...please change it |
|
syfe:
2018-04-13 17:29:30
My output is exactly same but it's showing wrong answer.
|
|
nadstratosfer:
2018-03-16 18:08:02
vedranab: Nothing, your approach is.
|
|
vedranab:
2018-03-16 10:17:20
What is wrong with programming in Phyton? |
|
jovice786:
2017-12-23 07:31:29
dont forget to look at range ,a nd b can be even too and u have to make them odd and use simple ap formula for summation and dont forger unsigned long long int |
Added by: | Ruhan Habib |
Date: | 2015-11-05 |
Time limit: | 0.5s-1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |
Resource: | Me? |