結果

問題 No.1701 half price
ユーザー SidewaysOwlSidewaysOwl
提出日時 2021-10-08 22:16:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 717 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 86,956 KB
実行使用メモリ 76,712 KB
最終ジャッジ日時 2023-09-30 10:38:11
合計ジャッジ時間 2,994 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,008 KB
testcase_01 AC 73 ms
71,228 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 79 ms
76,100 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 73 ms
71,248 KB
testcase_10 AC 72 ms
71,304 KB
testcase_11 WA -
testcase_12 AC 73 ms
71,388 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 72 ms
71,244 KB
testcase_16 AC 72 ms
71,184 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 72 ms
71,176 KB
testcase_21 AC 90 ms
76,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,w = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
for i in range(1 << n):
    l = [0]
#     l = []
    for j in range(n):
        if i & (1 << j):
            l.append(a[j])
    nn = len(l)

    for x in range(nn):
        res = 0
        for y in range(nn):
            if y == x:
                res += l[y] // 2
            else:
                res += l[y]
        if res == w:
             ans += 1

#     for x in range(1 << nn):
#         res = 0
#         for y in range(nn):
#             if x & (1 << y):
#                 res += l[y]
#             else:
#                 res += l[y] // 2
#         if res == w:
#             ans += 1
#             break
print(ans)
                
0