結果

問題 No.689 E869120 and Constructing Array 3
ユーザー H3PO4
提出日時 2020-11-28 08:50:33
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 449 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-12 22:10:33
合計ジャッジ時間 3,809 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 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([12] * rest)

    print(len(ans))
    print(ans)


solve(K)
0