結果
| 問題 | No.3658 Darumaka Number 2 |
| コンテスト | |
| ユーザー |
回転
|
| 提出日時 | 2026-08-30 13:55:53 |
| 言語 | PyPy3 (7.3.23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 497 bytes |
| 記録 | |
| コンパイル時間 | 1,615 ms |
| コンパイル使用メモリ | 95,340 KB |
| 実行使用メモリ | 94,080 KB |
| 最終ジャッジ日時 | 2026-08-30 13:56:18 |
| 合計ジャッジ時間 | 9,034 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 1 RE * 30 |
ソースコード
import pypyjit
pypyjit.set_param("max_unroll_recursion=-1")
import sys
sys.setrecursionlimit(10**5+100)
S = input()
N = len(S)
if(int(S) <= int("4" * N)):
print("5" * (N-1))
exit()
ans = []
def f(n,giri):
if(n == N):
print("".join(ans))
exit()
if(not giri or int(S[n]) >= 5):
ans.append("5")
f(n+1,giri and S[n] == "5")
ans.pop()
if(not giri or int(S[n]) >= 4):
ans.append("4")
f(n+1,giri and S[n] == "4")
f(0,True)
回転