結果

問題 No.1701 half price
ユーザー kohei2019kohei2019
提出日時 2023-06-04 17:16:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 549 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 77,300 KB
最終ジャッジ日時 2023-08-28 08:17:25
合計ジャッジ時間 3,105 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,296 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 75 ms
75,636 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 69 ms
71,524 KB
testcase_10 AC 69 ms
71,484 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 71 ms
71,036 KB
testcase_15 AC 71 ms
71,300 KB
testcase_16 AC 70 ms
71,512 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 70 ms
71,336 KB
testcase_21 AC 92 ms
76,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,W = map(int,input().split())
lsA = list(map(int,input().split()))
ans = 0
for j in range(2**N):
    lsA0 = []
    for k in range(N):
        if (j>>k) & 1:
            lsA0.append(lsA[k])
    flag = False
    for i in range(len(lsA0)):
        cost = 0
        for l in range(len(lsA0)):
            if l == i:
                cost += lsA0[l]//2
            else:
                cost += lsA0[l]
        if (cost == W):
            flag = True
            break
    if sum(lsA0) == W:
        flag = True
    if flag:
        ans += 1
print(ans)

0