結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー aoymats1aoymats1
提出日時 2022-08-05 21:42:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 165 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 100,092 KB
最終ジャッジ日時 2023-10-13 22:18:57
合計ジャッジ時間 4,716 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,408 KB
testcase_01 AC 69 ms
71,312 KB
testcase_02 AC 118 ms
99,924 KB
testcase_03 AC 70 ms
71,296 KB
testcase_04 AC 119 ms
99,908 KB
testcase_05 AC 120 ms
99,872 KB
testcase_06 AC 121 ms
100,092 KB
testcase_07 AC 86 ms
78,696 KB
testcase_08 AC 110 ms
93,084 KB
testcase_09 AC 87 ms
76,732 KB
testcase_10 AC 97 ms
84,008 KB
testcase_11 AC 87 ms
77,548 KB
testcase_12 AC 92 ms
81,184 KB
testcase_13 AC 88 ms
79,148 KB
testcase_14 AC 84 ms
76,764 KB
testcase_15 AC 88 ms
78,492 KB
testcase_16 AC 95 ms
82,008 KB
testcase_17 AC 75 ms
75,836 KB
testcase_18 AC 71 ms
71,056 KB
testcase_19 AC 72 ms
71,460 KB
testcase_20 AC 76 ms
75,924 KB
testcase_21 AC 71 ms
71,112 KB
testcase_22 AC 101 ms
89,224 KB
testcase_23 AC 96 ms
83,212 KB
testcase_24 AC 85 ms
77,136 KB
testcase_25 AC 108 ms
92,560 KB
testcase_26 AC 84 ms
78,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = []
for n in reversed(range(1, N + 1)):
    if S >= n:
        ans.append(n)
        S -= n

print(len(ans))
print(*ans[::-1])
0