問題一覧 > 通常問題

No.3240 Count 8 Included Numbers (Easy)

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 131
作問者 : 👑 AngrySadEight / テスター : 👑 p-adic ygussany
お気に入りにしたユーザー ProblemId : 12198 / 自分の提出
問題文最終更新日: 2025-07-04 00:58:57
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 479 AngrySadEightお誕生日コンテスト2025 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。