No.3240 Count 8 Included Numbers (Easy)
タグ : / 解いたユーザー数 131
作問者 : 👑
Problem Statement
This problem has the same setting as Count 8 Included Numbers (Hard) (Problem C of the contest); only the constraints and other minor details differ.
By submitting code that is accepted for Count 8 Included Numbers (Hard), you can also get this problem accepted.
AngrySadEight loves the digit $8$. So, he decided to count how many numbers contain $8$.
Find how many positive integers less than or equal to $N$ contain the digit $8$ in their decimal representation.
Constraints
- $N$ is an integer
- $1 \leq N \leq 888$
Input
The input is given from standard input in the following format.
$N$
Output
Output the answer.
Sample
Sample 1
Input
8
Output
1
Among the positive integers less than or equal to $8$, the only one containing $8$ is $8$ itself, so there are $1$ such number. Therefore, output $1$.
Sample 2
Input
88
Output
17
The positive integers less than or equal to $88$ that contain $8$ are the following $17$ numbers: $8, 18, 28, 38, 48, 58, 68, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88$. Therefore, output $17$.
Sample 3
Input
1
Output
0
There are no positive integers less than or equal to $1$ that contain $8$. Therefore, output $0$.
Sample 4
Input
888
Output
241
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。