#CCBCHBA0000028. Sum of Consecutive Odd Numbers I (Sum of Consecutive Odd Numbers I)
Sum of Consecutive Odd Numbers I (Sum of Consecutive Odd Numbers I)
Sum of Consecutive Odd Numbers I
Source: beecrowd
Version: Phuoc Hung OJ Extended
Problem Statement
Given x and y, sum all odd integers strictly between them, excluding both endpoints regardless of input order.
Input
Two integers x,y in [-10000,10000] (PHOJ Extended bound).
Output
One integer: the sum of odd integers strictly between.
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): .
Examples
Example 1
Input
6
-5
Output
5
Explanation
Odd values -3,-1,1,3,5 sum to 5.
Example 2
Input
7 8
Output
0
Explanation
Consecutive endpoints leave an empty interval.