#P10424. [蓝桥杯 2024 省 B] 好数

[蓝桥杯 2024 省 B] 好数

Problem 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 NN, compute how many good numbers there are from 11 to NN.

Input Format

An integer NN.

Output Format

An integer representing the answer.

24

7
2024

150

Hint

Explanation for Sample 1

The good numbers within 2424 are 1,3,5,7,9,21,231,3,5,7,9,21,23, for a total of 77.

Constraints

  • For 10%10\% of the testdata, 1N1001 \leq N \le 100.
  • For all testdata, 1N1071 \le N \leq 10^7.

Translated by ChatGPT 5