P28057 [洛谷] [Lanqiao Cup 2024 Provincial B] Good Numbers
普及
题目描述

Problem Description

An integer is considered a "good number" if, when read from the least significant digit to the most significant digit, the digits in odd positions (units, hundreds, ten-thousands, etc.) are odd, and the digits in even positions (tens, thousands, hundred-thousands, etc.) are even.

Given a positive integer $N$, calculate how many good numbers exist from $1$ to $N$.

Input Format

A single integer $N$.

Output Format

A single integer representing the answer.

Sample Input and Output

Sample Input #1

24

Sample Output #1

7

Sample Input #2

2024

Sample Output #2

150

Notes

Sample 1 Explanation

Within $24$, the good numbers are $1, 3, 5, 7, 9, 21, 23$, totaling $7$.

Data Size and Constraints

  • For $10\%$ of the test cases, $1 \leq N \leq 100$.
  • For all test cases, $1 \leq N \leq 10^7$.
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
24
样例输出
7