# LeetCode - 1523. Count Odd Numbers in an Interval Range ### 題目網址:https://leetcode.com/problems/count-odd-numbers-in-an-interval-range/ ###### tags: `LeetCode` `Easy` `數學` ```cpp= /* -LeetCode format- Problem: 1523. Count Odd Numbers in an Interval Range Difficulty: Easy by Inversionpeter */ class Solution { public: int countOdds(int low, int high) { return (high >> 1) + (high & 1) - (low >> 1); } }; ```