結果

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

ソースコード

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)
    f = 0
    for j in range(len(b)):
        if s - b[j] // 2 == w:
            f = 1
    if s == w:
        f = 1
    ans += f

print(ans)
0