結果

問題 No.1701 half price
ユーザー だれ
提出日時 2021-10-26 03:12:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 349 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 82,424 KB
実行使用メモリ 73,428 KB
最終ジャッジ日時 2024-10-04 06:19:39
合計ジャッジ時間 1,787 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 12
権限があれば一括ダウンロードができます

ソースコード

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