結果

問題 No.1701 half price
ユーザー だれだれ
提出日時 2021-10-26 03:12:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 349 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 82,580 KB
実行使用メモリ 73,064 KB
最終ジャッジ日時 2024-04-15 00:09:00
合計ジャッジ時間 2,138 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,340 KB
testcase_01 AC 40 ms
52,344 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 39 ms
53,036 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 38 ms
53,816 KB
testcase_10 AC 38 ms
53,536 KB
testcase_11 WA -
testcase_12 AC 39 ms
52,396 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 38 ms
52,988 KB
testcase_16 AC 37 ms
52,616 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 38 ms
52,936 KB
testcase_21 AC 59 ms
71,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, w = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)
ans = 0
for i in range(1, 1 << n):
    b = []
    for j in range(n):
        if i >> j & 1:
            b.append(a[j])
    s = sum(b)
    for j in range(len(b)):
        if s - b[j] // 2 == w:
            ans += 1
    if s == w:
        ans += 1

print(ans)
0