問題一覧 > 通常問題

No.1849 Three Times Value

レベル : / AI推定難易度 : 220 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 104
作問者 : matcharate12 / テスター : Shirotsume
お気に入りにしたユーザー ProblemId : 7785 / 自分の提出
問題文最終更新日: 2022-04-01 11:33:15
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

Problem Statement

A number formed by concatenating $3$ copies of the same number as a string, such as $111,141414$, is defined as a triple number. However, a number whose most significant digit is $0$, such as $000,010101$, is not a triple number.
How many triple numbers are there among the numbers between $1$ and $N$, inclusive?

Input

$N$

・$1\le N\le 10^{15}$

Output

Output the answer.

Sample

Sample 1
Input
400
Output
3

$111,222,333$ satisfy the condition, so the answer is $3$ numbers. Therefore, output $3$.

Sample 2
Input
12
Output
0

No number satisfies the condition.

Sample 3
Input
77777777777
Output
999

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。