結果

問題 No.689 E869120 and Constructing Array 3
ユーザー H3PO4
提出日時 2020-11-28 08:53:06
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 1,000 ms
コード長 450 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-12 22:10:50
合計ジャッジ時間 2,114 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

tri = lambda x: x * (x - 1) // 2
K = int(input())


def solve(K):
    i = 1
    while True:
        if tri(i + 1) <= K:
            i += 1
        else:
            break

    ans = [1] * i

    rest = K - tri(i)
    DIV = 5
    if rest // DIV:
        ans.extend([3] * DIV)
        ans.extend([8] * (rest // DIV))
        rest %= DIV
    if rest:
        ans.append(7)
        ans.extend([24] * rest)

    print(len(ans))
    print(*ans)


solve(K)
0