No.3658 Darumaka Number 2
レベル :
/ AI推定難易度 : 875
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 1024 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 76
作問者 :
dyktr_06
/ テスター :
tyawanmusi
sepa38
くらげ
t5ugu
タグ : / 解いたユーザー数 76
作問者 :
sepa38
くらげ
問題文最終更新日: 2026-08-29 17:44:27
English (AI translation)
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
MMA Contest 022
(順位表)
の他の問題:
Problem Statement
In Pokémon, Darumaka's National Pokédex number is $554$, which consists only of the digits $4$ and $5$.
We define a good number as a positive integer that consists only of the digits $4$ and $5$, like this one.
Find the largest good number less than or equal to $N$.
Constraints
- $4 \leq N < 10^{100000}$
- All inputs are integers.
Input
The input is given from Standard Input in the following format.
$N$
Output
Print the answer on a single line.
Sample
Sample 1
Input
52
Output
45
The good numbers, in ascending order, are $4$, $5$, $44$, $45$, $54$, $\cdots$, so print $45$, the largest one less than or equal to $52$.
Sample 2
Input
554
Output
554
Sample 3
Input
12345678901234567890
Output
5555555555555555555
Note that the input may not fit in a $64$-bit integer.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。