結果

問題 No.689 E869120 and Constructing Array 3
ユーザー daku9640daku9640
提出日時 2018-05-19 00:39:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 442 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 10,724 KB
実行使用メモリ 8,104 KB
最終ジャッジ日時 2023-09-10 23:30:18
合計ジャッジ時間 4,669 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 18 ms
7,876 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 27 ms
7,896 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 35 ms
7,968 KB
testcase_11 WA -
testcase_12 AC 91 ms
7,956 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import factorial
c = lambda y, x: factorial(y) // factorial(x) // factorial(y - x)
def solve():
    k = int(input())
    if k <= 250:
        return [1] + [4] * (k - 1)
    for i in range(2, 251):
        for j in range(2, 251 - i):
            if i * j + c(i, 2) == k:
                return [1] * i + [4] * j
            if c(i, 2) == k:
                return [2] * i + [3] * j
    return [0]
v = solve()
print(len(v))
print(*v)
0