結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー ああいいああいい
提出日時 2022-08-07 16:13:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 276 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 81,648 KB
実行使用メモリ 98,060 KB
最終ジャッジ日時 2023-10-17 11:11:10
合計ジャッジ時間 3,545 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,296 KB
testcase_01 AC 36 ms
53,296 KB
testcase_02 AC 86 ms
97,984 KB
testcase_03 WA -
testcase_04 AC 89 ms
98,060 KB
testcase_05 AC 90 ms
97,996 KB
testcase_06 AC 92 ms
97,996 KB
testcase_07 AC 51 ms
70,336 KB
testcase_08 AC 77 ms
91,132 KB
testcase_09 AC 47 ms
64,224 KB
testcase_10 AC 63 ms
82,420 KB
testcase_11 AC 49 ms
67,184 KB
testcase_12 AC 54 ms
73,748 KB
testcase_13 AC 53 ms
72,804 KB
testcase_14 AC 48 ms
66,404 KB
testcase_15 AC 51 ms
70,336 KB
testcase_16 AC 55 ms
76,928 KB
testcase_17 AC 38 ms
53,304 KB
testcase_18 AC 37 ms
53,304 KB
testcase_19 AC 36 ms
53,304 KB
testcase_20 AC 39 ms
53,304 KB
testcase_21 AC 38 ms
53,304 KB
testcase_22 AC 72 ms
87,700 KB
testcase_23 AC 63 ms
81,364 KB
testcase_24 AC 50 ms
66,940 KB
testcase_25 AC 76 ms
90,604 KB
testcase_26 AC 52 ms
72,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

import sys
if S <= N:
    print(S)
    exit()
tmp = 0
ans = []
for i in range(N,0,-1):
    if tmp + i <= S:
        ans.append(i)
        tmp += i
    else:
        break
if S - tmp > 0:
    ans.append(S - tmp)
print(len(ans))
print(*ans[::-1])
0