結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー TomoyarnTomoyarn
提出日時 2022-11-04 20:44:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 278 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 99,928 KB
最終ジャッジ日時 2023-09-25 22:53:08
合計ジャッジ時間 6,265 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,268 KB
testcase_01 AC 74 ms
71,272 KB
testcase_02 AC 121 ms
99,804 KB
testcase_03 AC 73 ms
71,232 KB
testcase_04 AC 119 ms
99,756 KB
testcase_05 AC 118 ms
99,928 KB
testcase_06 AC 118 ms
99,928 KB
testcase_07 AC 84 ms
78,480 KB
testcase_08 AC 108 ms
92,932 KB
testcase_09 AC 82 ms
76,632 KB
testcase_10 AC 95 ms
84,016 KB
testcase_11 AC 85 ms
77,316 KB
testcase_12 AC 88 ms
79,972 KB
testcase_13 AC 87 ms
78,924 KB
testcase_14 AC 85 ms
76,720 KB
testcase_15 AC 86 ms
78,568 KB
testcase_16 AC 94 ms
82,188 KB
testcase_17 AC 73 ms
71,140 KB
testcase_18 AC 72 ms
71,260 KB
testcase_19 AC 73 ms
71,296 KB
testcase_20 AC 73 ms
71,396 KB
testcase_21 AC 77 ms
71,428 KB
testcase_22 AC 102 ms
89,248 KB
testcase_23 AC 94 ms
83,160 KB
testcase_24 AC 84 ms
77,160 KB
testcase_25 AC 108 ms
92,400 KB
testcase_26 AC 86 ms
78,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = []

while True:
    if N < S:
        if N == 0:
            break
        else:
            ans.append(N)
            S -= N
            N -= 1
            
    else:
        ans.append(S)
        break

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