結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー hir355hir355
提出日時 2022-08-05 21:57:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 151 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 98,100 KB
最終ジャッジ日時 2023-10-13 22:43:41
合計ジャッジ時間 4,833 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,176 KB
testcase_01 AC 74 ms
71,224 KB
testcase_02 AC 121 ms
98,092 KB
testcase_03 AC 72 ms
71,276 KB
testcase_04 AC 117 ms
97,940 KB
testcase_05 AC 117 ms
98,032 KB
testcase_06 AC 120 ms
98,100 KB
testcase_07 AC 92 ms
78,348 KB
testcase_08 AC 116 ms
91,856 KB
testcase_09 AC 87 ms
76,576 KB
testcase_10 AC 98 ms
83,364 KB
testcase_11 AC 87 ms
77,324 KB
testcase_12 AC 88 ms
79,480 KB
testcase_13 AC 89 ms
78,672 KB
testcase_14 AC 83 ms
76,524 KB
testcase_15 AC 89 ms
78,132 KB
testcase_16 AC 99 ms
81,480 KB
testcase_17 AC 77 ms
75,596 KB
testcase_18 AC 73 ms
71,092 KB
testcase_19 AC 74 ms
71,312 KB
testcase_20 AC 77 ms
75,576 KB
testcase_21 AC 74 ms
71,316 KB
testcase_22 AC 104 ms
88,456 KB
testcase_23 AC 91 ms
82,648 KB
testcase_24 AC 81 ms
77,104 KB
testcase_25 AC 105 ms
91,364 KB
testcase_26 AC 86 ms
78,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, s = map(int, input().split())
a = []
for i in range(n, 0, -1):
    if s >= i:
        s -= i
        a.append(i)
a.reverse()
print(len(a))
print(*a)
0