結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー とりゐとりゐ
提出日時 2022-07-21 22:14:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 124 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 86,736 KB
実行使用メモリ 99,772 KB
最終ジャッジ日時 2023-09-28 13:22:42
合計ジャッジ時間 5,036 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,100 KB
testcase_01 AC 75 ms
71,052 KB
testcase_02 AC 126 ms
99,668 KB
testcase_03 AC 75 ms
71,220 KB
testcase_04 AC 127 ms
99,740 KB
testcase_05 AC 126 ms
99,772 KB
testcase_06 AC 128 ms
99,456 KB
testcase_07 AC 90 ms
78,488 KB
testcase_08 AC 117 ms
92,532 KB
testcase_09 AC 88 ms
76,244 KB
testcase_10 AC 103 ms
83,840 KB
testcase_11 AC 89 ms
77,384 KB
testcase_12 AC 94 ms
79,676 KB
testcase_13 AC 92 ms
78,908 KB
testcase_14 AC 90 ms
76,596 KB
testcase_15 AC 90 ms
78,064 KB
testcase_16 AC 99 ms
81,824 KB
testcase_17 AC 78 ms
71,092 KB
testcase_18 AC 75 ms
71,252 KB
testcase_19 AC 77 ms
71,056 KB
testcase_20 AC 80 ms
75,252 KB
testcase_21 AC 76 ms
71,088 KB
testcase_22 AC 106 ms
89,100 KB
testcase_23 AC 99 ms
83,040 KB
testcase_24 AC 88 ms
77,044 KB
testcase_25 AC 112 ms
92,072 KB
testcase_26 AC 90 ms
78,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,s=map(int,input().split())
ans=[]
while s:
  if s>=n:
    ans.append(n)
    s-=n
  n-=1

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