結果

問題 No.1701 half price
ユーザー Takuya NoguchiTakuya Noguchi
提出日時 2021-10-19 22:02:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 537 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 81,364 KB
実行使用メモリ 76,512 KB
最終ジャッジ日時 2023-10-20 10:51:27
合計ジャッジ時間 8,160 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,340 KB
testcase_01 AC 50 ms
62,172 KB
testcase_02 AC 244 ms
76,048 KB
testcase_03 AC 47 ms
62,196 KB
testcase_04 AC 264 ms
75,988 KB
testcase_05 AC 69 ms
73,012 KB
testcase_06 AC 1,789 ms
76,172 KB
testcase_07 AC 1,652 ms
76,152 KB
testcase_08 WA -
testcase_09 AC 49 ms
62,176 KB
testcase_10 AC 36 ms
53,340 KB
testcase_11 AC 47 ms
62,176 KB
testcase_12 AC 47 ms
62,176 KB
testcase_13 AC 46 ms
62,176 KB
testcase_14 AC 48 ms
62,176 KB
testcase_15 AC 47 ms
62,176 KB
testcase_16 AC 35 ms
53,340 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 36 ms
53,340 KB
testcase_21 AC 1,613 ms
76,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def base10to(n, b):
    if (int(n/b)):
        return base10to(int(n/b), b) + str(n%b)
    return str(n%b)

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

for n in range(3**N):
    bit_str = base10to(n, 3).rjust(N, '0')

    sum, key = 0, 0
    for i, bit in enumerate(bit_str):
        if bit == '0':
            continue

        if bit == '1':
            sum += a[i]
        else:
            sum += a[i] // 2
        key += (1 << i)

    if sum == W:
        answer.add(key)

print(len(answer))
0