Submit | All submissions | Best solutions | Back to list |
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
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? |
hide comments
|
|||||||
2021-01-28 16:29:47
@kass_97 plz help, idk how to use spoj toolkit. i did everything right but its showing wrong problem EASY ODD SUM |
|||||||
2020-10-01 09:31:34
this is addition of two large integer sum.BIG INTEGER WILL BE USED. |
|||||||
2020-06-22 19:43:47
ac in one go!! use unsigned long long int and take range(a,b] |
|||||||
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: x86_64-linux-gnu-gcc-8 -c -pipe -O2 test.adb test.adb:1:01: compilation unit expected test.adb:6:19: missing string quote test.adb:10:15: missing string quote test.adb:12:15: missing string quote x86_64-linux-gnu-gnatmake-8: "test.adb" compilation error |
|||||||
2018-12-19 10:29:59
very simple!!! |
|||||||
2018-08-22 07:11:39
yes the range should be (a,b]. the question is wrong ...please change it |
|||||||
2018-04-13 17:29:30
My output is exactly same but it's showing wrong answer. Can anyone please help? |
|||||||
2018-03-16 18:08:02
vedranab: Nothing, your approach is. https://hr.wikipedia.org/wiki/Aritmeti%C4%8Dki_niz |
|||||||
2018-03-16 10:17:20
What is wrong with programming in Phyton? |
|||||||
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 |