結果

問題 No.1701 half price
ユーザー harurun
提出日時 2021-10-02 02:08:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 641 ms / 3,000 ms
コード長 411 bytes
コンパイル時間 376 ms
コンパイル使用メモリ 82,704 KB
実行使用メモリ 76,244 KB
最終ジャッジ日時 2024-07-23 03:45:46
合計ジャッジ時間 4,948 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  N,W=map(int,input().split())
  a=list(map(int,input().split()))
  ans=set()
  for i in range(1,pow(3,N)):
    s=0
    M=i
    l=[]
    for j in range(N):
      if M%3==1:
        s+=a[j]//2
        l.append(1)
      elif M%3==2:
        s+=a[j]
        l.append(1)
      else:
        l.append(0)
      M//=3
    if s==W:
      ans.add("".join(map(str,l)))
  print(len(ans))
  return    

main()

0