結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,464 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 37 ms
52,752 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 37 ms
52,344 KB
testcase_09 AC 37 ms
53,744 KB
testcase_10 AC 37 ms
53,100 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 37 ms
52,248 KB
testcase_15 AC 37 ms
52,944 KB
testcase_16 AC 37 ms
52,344 KB
testcase_17 AC 55 ms
67,272 KB
testcase_18 AC 39 ms
52,368 KB
testcase_19 AC 43 ms
59,292 KB
testcase_20 AC 36 ms
53,008 KB
testcase_21 AC 57 ms
71,708 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)
    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