結果
問題 | No.1701 half price |
ユーザー |
![]() |
提出日時 | 2022-09-12 20:48:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 611 ms / 3,000 ms |
コード長 | 546 bytes |
コンパイル時間 | 333 ms |
コンパイル使用メモリ | 82,396 KB |
実行使用メモリ | 76,420 KB |
最終ジャッジ日時 | 2024-11-29 21:59:15 |
合計ジャッジ時間 | 3,980 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
from itertools import productn,w=map(int,input().split())a=list(map(int,input().split()))ans=0for i in product([0,1],repeat=n):t=i.count(1)if t == 0:continuefor j in product([0,1],repeat=t):indj=0cntw=0for k in range(n):if i[k] == 1:if j[indj] == 1:cntw += a[k]//2else:cntw += a[k]indj+=1if cntw == w:ans+=1breakprint(ans)