結果

問題 No.1701 half price
ユーザー SidewaysOwlSidewaysOwl
提出日時 2021-10-08 22:21:19
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 340 ms / 3,000 ms
コード長 523 bytes
コンパイル時間 1,027 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 76,644 KB
最終ジャッジ日時 2023-09-30 10:45:40
合計ジャッジ時間 4,284 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
70,528 KB
testcase_01 AC 69 ms
70,736 KB
testcase_02 AC 108 ms
76,332 KB
testcase_03 AC 72 ms
70,888 KB
testcase_04 AC 105 ms
76,496 KB
testcase_05 AC 80 ms
75,808 KB
testcase_06 AC 340 ms
76,392 KB
testcase_07 AC 336 ms
76,644 KB
testcase_08 AC 69 ms
70,824 KB
testcase_09 AC 70 ms
70,460 KB
testcase_10 AC 69 ms
70,752 KB
testcase_11 AC 69 ms
70,828 KB
testcase_12 AC 71 ms
70,872 KB
testcase_13 AC 70 ms
70,828 KB
testcase_14 AC 70 ms
70,740 KB
testcase_15 AC 69 ms
70,832 KB
testcase_16 AC 68 ms
71,016 KB
testcase_17 AC 80 ms
75,912 KB
testcase_18 AC 70 ms
70,600 KB
testcase_19 AC 73 ms
75,472 KB
testcase_20 AC 69 ms
70,976 KB
testcase_21 AC 328 ms
76,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,w = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
for i in range(1,1 << n):
#     print()
    l = []
    for j in range(n):
        if i & (1 << j):
            l.append(a[j])
    nn = len(l)
    
    for x in range(1 << nn):
        res = 0
#         print(format(int(format(x,"b")),"0=10"))
        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