結果

問題 No.1701 half price
ユーザー 👑 KazunKazun
提出日時 2021-10-08 21:56:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 500 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 76,852 KB
最終ジャッジ日時 2023-09-30 09:58:48
合計ジャッジ時間 3,544 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,200 KB
testcase_01 AC 73 ms
71,292 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 78 ms
75,792 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 74 ms
71,160 KB
testcase_10 AC 73 ms
71,372 KB
testcase_11 WA -
testcase_12 AC 73 ms
71,040 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 73 ms
70,888 KB
testcase_16 AC 71 ms
71,304 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 72 ms
71,184 KB
testcase_21 AC 95 ms
76,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,W=map(int,input().split())

A=list(map(int,input().split()))

X=0

for S in range(1<<N):
    for i in range(N):
        if S&(1<<i)==0:
            continue

        alpha=0
        for j in range(N):
            if S&(1<<j):
                if i!=j:
                    alpha+=A[j]
                else:
                    alpha+=A[j]//2

        if alpha==W:
            X+=1

    beta=0
    for i in range(N):
        if S&(1<<i):
            beta+=A[i]

    if beta==W:
        X+=1

print(X)
0