結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー H3PO4H3PO4
提出日時 2022-08-05 21:25:20
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 204 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,520 KB
実行使用メモリ 19,280 KB
最終ジャッジ日時 2023-10-13 21:48:12
合計ジャッジ時間 3,626 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,796 KB
testcase_01 AC 15 ms
7,872 KB
testcase_02 AC 160 ms
19,176 KB
testcase_03 AC 15 ms
7,744 KB
testcase_04 AC 162 ms
19,180 KB
testcase_05 AC 166 ms
19,208 KB
testcase_06 AC 165 ms
19,280 KB
testcase_07 AC 37 ms
9,752 KB
testcase_08 AC 123 ms
16,120 KB
testcase_09 AC 23 ms
8,664 KB
testcase_10 AC 65 ms
11,884 KB
testcase_11 AC 29 ms
9,020 KB
testcase_12 AC 44 ms
10,296 KB
testcase_13 AC 39 ms
9,988 KB
testcase_14 AC 27 ms
9,104 KB
testcase_15 AC 36 ms
9,856 KB
testcase_16 AC 53 ms
10,940 KB
testcase_17 AC 15 ms
7,868 KB
testcase_18 AC 14 ms
7,884 KB
testcase_19 AC 15 ms
7,840 KB
testcase_20 AC 14 ms
7,800 KB
testcase_21 AC 15 ms
7,780 KB
testcase_22 AC 97 ms
14,464 KB
testcase_23 AC 58 ms
11,720 KB
testcase_24 AC 26 ms
9,036 KB
testcase_25 AC 114 ms
15,468 KB
testcase_26 AC 41 ms
9,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, S = map(int, input().split())

ans = []
for x in range(N, 0, -1):
    if S <= x:
        break
    ans.append(x)
    S -= x
    x -= 1
if S:
    ans.append(S)
ans.reverse()
print(len(ans))
print(*ans)
0