結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー lilictakalilictaka
提出日時 2022-08-10 12:45:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 204 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 81,820 KB
実行使用メモリ 96,768 KB
最終ジャッジ日時 2023-10-20 22:19:39
合計ジャッジ時間 3,475 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,416 KB
testcase_01 AC 37 ms
53,416 KB
testcase_02 AC 92 ms
96,504 KB
testcase_03 AC 39 ms
53,416 KB
testcase_04 AC 96 ms
96,768 KB
testcase_05 AC 96 ms
96,504 KB
testcase_06 AC 92 ms
96,684 KB
testcase_07 AC 56 ms
72,268 KB
testcase_08 AC 83 ms
90,168 KB
testcase_09 AC 53 ms
68,432 KB
testcase_10 AC 69 ms
81,984 KB
testcase_11 AC 56 ms
71,236 KB
testcase_12 AC 58 ms
76,032 KB
testcase_13 AC 57 ms
72,656 KB
testcase_14 AC 53 ms
68,564 KB
testcase_15 AC 58 ms
74,320 KB
testcase_16 AC 67 ms
80,136 KB
testcase_17 AC 42 ms
59,456 KB
testcase_18 AC 40 ms
53,416 KB
testcase_19 AC 39 ms
53,416 KB
testcase_20 AC 43 ms
59,456 KB
testcase_21 AC 40 ms
53,416 KB
testcase_22 AC 74 ms
86,736 KB
testcase_23 AC 64 ms
80,928 KB
testcase_24 AC 51 ms
66,904 KB
testcase_25 AC 79 ms
89,640 KB
testcase_26 AC 54 ms
72,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def cum2(n):
    return ((1 + n) * n)//2
ans = []
N,S = map(int,input().split())
for i in reversed(range(1,N+1)):
    if S >= i:
        S -= i
        ans.append(i)
ans.sort()
print(len(ans))
print(*ans)
0