結果

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

ソースコード

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([12] * rest)

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


solve(K)
0