結果

問題 No.3316 Make 81181819 with only 0,1,or 8
コンテスト
ユーザー hitori6541
提出日時 2025-10-31 21:26:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 570 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 82,348 KB
実行使用メモリ 54,336 KB
最終ジャッジ日時 2025-10-31 21:26:26
合計ジャッジ時間 4,592 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n = int(input())
    rem = 81181819 - n
    ret = [0] * 7
    cur = 9
    while rem:
        w = 10**cur
        a = rem // w
        if a == 0:
            pass
        elif 1 <= a < 8:
            for i in range(a):
                ret[i] += w
        elif a == 8:
            ret[0] += 8*w
        elif a == 9:
            ret[0] += 8*w
            ret[1] += w
        rem %= w
        cur -= 1
    
    while ret[-1] == 0:
        ret.pop()
    
    print(len(ret))
    print(*ret, sep="\n")

t = int(input())
ans = []
for _ in range(t):
    solve()
0