結果

問題 No.3625 Find Superfibonacci Number
コンテスト
ユーザー detteiuu
提出日時 2026-08-14 22:11:51
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 85 ms / 2,000 ms
+ 185µs
コード長 599 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 618 ms
コンパイル使用メモリ 95,720 KB
実行使用メモリ 84,404 KB
最終ジャッジ日時 2026-08-14 22:11:55
合計ジャッジ時間 3,248 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from sys import stdin
input = stdin.readline

def digitSUM(n):
    return sum(int(s) for s in str(n))

memo = dict()
for K in range(1, 18):
    res = 1<<60
    for n in range(100, 10**3+1):
        s = str(n)
        if digitSUM(n) == K and any(int(s[i]) > int(s[i+1])+int(s[i+2]) for i in range(len(s)-2)):
            res = min(res, n)
    memo[K] = res

for _ in range(int(input())):
    K = int(input())

    if K in memo:
        print(memo[K])
        continue

    if K%9 == 8:
        print("908"+"9"*((K-17)//9))
    else:
        s = (K+1)%9
        print(str(s)+"908"+"9"*((K-(17+s))//9))
0