P10424 [Lanqiao Cup 2024 NOI Qualifier B] Good Numbers
Description
If an integer, when read from the lowest digit to the highest digit, has odd digits in odd positions (ones, hundreds, ten-thousands, ...) and even digits in even positions (tens, thousands, hundred-thousands, ...), then we call it a "good number".
Given a positive integer $N$, compute how many good numbers there are from $1$ to $N$.
Input Format
An integer $N$.
Output Format
An integer representing the answer.
Explanation/Hint
### Explanation for Sample 1
The good numbers within $24$ are $1,3,5,7,9,21,23$, for a total of $7$.
### Constraints
- For $10\%$ of the testdata, $1 \leq N \le 100$.
- For all testdata, $1 \le N \leq 10^7$.
Translated by ChatGPT 5