結果
問題 | No.1701 half price |
ユーザー |
|
提出日時 | 2021-10-08 22:20:09 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 810 ms / 3,000 ms |
コード長 | 473 bytes |
コンパイル時間 | 368 ms |
コンパイル使用メモリ | 82,580 KB |
実行使用メモリ | 76,636 KB |
最終ジャッジ日時 | 2024-07-23 04:50:45 |
合計ジャッジ時間 | 4,328 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
N,W = map(int,input().split()) A = list(map(int,input().split())) ans = 0 for i in range(1,2**N): bit = bin(i)[2:].zfill(N) B = [] for j in range(N): if bit[j] == '1': B.append(A[j]) M = len(B) flg = False for j in range(2**M): bit_b = bin(j)[2:].zfill(M) c = 0 for k in range(M): if bit_b[k] == '1': c += (B[k]//2) else: c += B[k] if c == W: flg = True break if flg: ans += 1 print(ans)