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
|
|||||||
2017-12-14 16:07:54
It seems like an easy one but I can't get it right. I either get compilation error or wrong answer. Can someone help with where I can look for help? |
|||||||
2017-07-30 22:52:38
just a minor mistake cost me 2 wa's Last edit: 2017-07-30 22:56:23 |
|||||||
2017-04-19 07:27:16
unsigned long long was my solution :| |
|||||||
2017-04-19 01:48:47
I'm curious how the heck I'm getting a "wrong" answer on this, would be nice to see feedback on a case that is wrong! :( ... even using unsigned long for the sum preventing overflow :( ... This should be so simple :( |
|||||||
2017-02-21 13:14:18
Don't look at Spoj toolkit ans , the range is [a,b] |
|||||||
2017-02-17 11:24:07
Range given is wrong. Cost me 2 WAs. It must be (a,b] |
|||||||
2017-01-12 11:52:31
Range of i given incorrect....use spoj toolkit to check the output of your program and you'll get to know, cost me 1 WA |
|||||||
2016-07-20 13:32:18
very simple .. |
|||||||
2016-07-03 08:20:25
very easy ac in 1 go..!! focus on boundary..!! |
|||||||
2016-06-18 14:59:18
i am getting compilation error or wrong answer. can someone help me ? |