結果
問題 |
No.1701 half price
|
ユーザー |
![]() |
提出日時 | 2021-10-08 23:00:38 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 723 bytes |
コンパイル時間 | 370 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 14,848 KB |
最終ジャッジ日時 | 2024-07-23 06:18:44 |
合計ジャッジ時間 | 2,603 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 8 WA * 12 |
ソースコード
from itertools import product N,W = map(int,input().split()) A = list(map(int,input().split())) bit_lst = list(product([False, True], repeat=N)) goods_lst = [] for bits in bit_lst[1:]: i = 0 goods = [] for bit in bits: if bit: goods.append(A[i]) i += 1 goods_lst.append(goods) # print(goods_lst) yen_lst = [] for goods in goods_lst: bit_lst = [[True] * len(goods) for _ in range(len(goods)+1)] for l in range(len(goods)): bit_lst[l][l] = False # print(bit_lst, goods) for bits in bit_lst: yen = 0 for i, bit in enumerate(bits): if bit: yen += goods[i] else: yen += goods[i] / 2 yen_lst.append(yen) # print(yen_lst) ans = 0 for yen in yen_lst: if W == yen: ans += 1 print(ans)