結果

問題 No.689 E869120 and Constructing Array 3
ユーザー kerotonokerotono
提出日時 2018-05-19 00:18:26
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-28 14:12:17
合計ジャッジ時間 2,203 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#!python
# -*- coding: utf-8 -*-


def main():
    K = int(input())
    if K > 8000:
        i = 0
        n = 0
        while n + i + 1 < K:
            i += 1
            n += i
        s = ('1 ' * (i + 1) + '3 3 ' + '8 ' *
             ((K - n) // 2) + '6 7' * ((K - n) % 2))[:-1]
        print(i + 1 + 2 + (K - n) // 2 + ((K - n) % 2) * 2)
        print(s)
        return

    i = 0
    n = 0
    while n + i + 1 <= K:
        i += 1
        n += i
    s = ('1 ' * (i + 1) + '5 ' + '8 ' * (K - n))[:-1]
    print((len(s) + 1) // 2)
    print(s)


if __name__ == '__main__':
    main()
0