結果
| 問題 | No.3658 Darumaka Number 2 |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-08-30 13:47:35 |
| 言語 | PyPy3 (7.3.23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 573 bytes |
| 記録 | |
| コンパイル時間 | 258 ms |
| コンパイル使用メモリ | 95,724 KB |
| 実行使用メモリ | 84,352 KB |
| 最終ジャッジ日時 | 2026-08-30 13:47:46 |
| 合計ジャッジ時間 | 5,456 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 WA * 6 |
ソースコード
S = input()
N = len(S)
if S < "4"*N:
exit(print("5"*(N-1)))
ans = [-1]*N
small = False
idx = -1
for i in range(N):
if not small:
if 4 == int(S[i]):
ans[i] = 4
elif 5 == int(S[i]):
ans[i] = 5
elif 5 < int(S[i]):
ans[i] = 5
small = True
else:
ans[i] = 5
idx = i
small = True
else:
ans[i] = 5
if idx != -1:
for i in reversed(range(idx)):
if S[i] == "5":
ans[i] = 4
break
print("".join(map(str, ans)))
detteiuu