結果

問題 No.1701 half price
ユーザー tobusakanatobusakana
提出日時 2022-12-03 05:48:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 352 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 62,592 KB
最終ジャッジ日時 2024-04-18 14:24:20
合計ジャッジ時間 2,065 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,968 KB
testcase_01 AC 45 ms
51,712 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 42 ms
52,096 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 41 ms
51,712 KB
testcase_10 AC 41 ms
51,712 KB
testcase_11 WA -
testcase_12 AC 40 ms
51,968 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 41 ms
51,968 KB
testcase_16 AC 40 ms
51,712 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 41 ms
51,968 KB
testcase_21 AC 57 ms
62,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,W = map(int,input().split())
A = list(map(int,input().split()))

ans = 0
for status in range(1 << N):
    val = 0
    for i in range(N):
        if (status >> i) & 1:
            val += A[i]
    if val == W:
        ans += 1
    for i in range(N):
        if (status >> i) & 1:
            if val - A[i] // 2 == W:
                ans += 1
print(ans)
0