結果

問題 No.1701 half price
ユーザー ああいいああいい
提出日時 2021-12-03 22:06:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 397 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 10,644 KB
実行使用メモリ 8,016 KB
最終ジャッジ日時 2023-09-20 10:05:43
合計ジャッジ時間 2,517 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,860 KB
testcase_01 WA -
testcase_02 AC 36 ms
7,856 KB
testcase_03 WA -
testcase_04 AC 30 ms
7,784 KB
testcase_05 AC 15 ms
7,964 KB
testcase_06 AC 208 ms
7,820 KB
testcase_07 WA -
testcase_08 AC 15 ms
7,808 KB
testcase_09 AC 15 ms
7,864 KB
testcase_10 AC 15 ms
7,788 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 15 ms
7,784 KB
testcase_16 AC 15 ms
7,932 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 15 ms
7,844 KB
testcase_21 AC 156 ms
7,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

count = 0
def calc(now = 0,sum = 0):
    global count
    if now == N-1:
        if sum == W:count += 1
        elif sum + a[now] // 2 == W:count += 1
        elif sum + a[now] == W:count += 1
    else:
        calc(now + 1,sum)
        calc(now + 1,sum + a[now] // 2)
        calc(now + 1,sum + a[now])
calc()
print(count)
0