結果

問題 No.1701 half price
ユーザー SidewaysOwlSidewaysOwl
提出日時 2021-10-08 22:14:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 698 bytes
コンパイル時間 1,303 ms
コンパイル使用メモリ 86,716 KB
実行使用メモリ 76,944 KB
最終ジャッジ日時 2023-09-30 10:35:00
合計ジャッジ時間 4,087 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,096 KB
testcase_01 AC 67 ms
71,252 KB
testcase_02 AC 104 ms
76,944 KB
testcase_03 AC 68 ms
71,136 KB
testcase_04 AC 96 ms
76,176 KB
testcase_05 AC 75 ms
76,228 KB
testcase_06 AC 331 ms
76,760 KB
testcase_07 AC 327 ms
76,612 KB
testcase_08 WA -
testcase_09 AC 70 ms
71,120 KB
testcase_10 AC 67 ms
71,076 KB
testcase_11 AC 66 ms
71,112 KB
testcase_12 AC 69 ms
71,240 KB
testcase_13 AC 70 ms
71,300 KB
testcase_14 AC 70 ms
71,088 KB
testcase_15 AC 69 ms
71,212 KB
testcase_16 AC 68 ms
71,112 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 66 ms
71,108 KB
testcase_21 AC 321 ms
76,804 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