結果

問題 No.1701 half price
ユーザー lllllll88938494
提出日時 2022-09-12 20:44:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 506 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 76,112 KB
最終ジャッジ日時 2024-11-29 21:54:30
合計ジャッジ時間 3,480 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
n,w=map(int,input().split())
a=list(map(int,input().split()))
ans=0

for i in product([0,1],repeat=n):
    for j in product([0,1],repeat=i.count(1)):
        indj=0
        cntw=0
        for k in range(n):
            if i[k] == 1:
                if j[indj] == 1:
                    cntw += a[k]//2
                else:
                    cntw += a[k]
                indj+=1
        
        if cntw == w:
            ans+=1
            break
                
print(ans)
0