結果

問題 No.1701 half price
ユーザー harurunharurun
提出日時 2021-10-02 02:08:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 583 ms / 3,000 ms
コード長 411 bytes
コンパイル時間 1,570 ms
コンパイル使用メモリ 86,832 KB
実行使用メモリ 77,360 KB
最終ジャッジ日時 2023-09-30 09:40:36
合計ジャッジ時間 5,472 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
71,352 KB
testcase_01 AC 71 ms
76,068 KB
testcase_02 AC 108 ms
76,824 KB
testcase_03 AC 65 ms
76,080 KB
testcase_04 AC 106 ms
76,852 KB
testcase_05 AC 74 ms
76,440 KB
testcase_06 AC 583 ms
76,852 KB
testcase_07 AC 567 ms
77,324 KB
testcase_08 AC 59 ms
71,360 KB
testcase_09 AC 65 ms
76,196 KB
testcase_10 AC 63 ms
71,468 KB
testcase_11 AC 65 ms
76,104 KB
testcase_12 AC 65 ms
75,860 KB
testcase_13 AC 65 ms
76,180 KB
testcase_14 AC 66 ms
76,696 KB
testcase_15 AC 66 ms
76,164 KB
testcase_16 AC 66 ms
71,312 KB
testcase_17 AC 388 ms
77,360 KB
testcase_18 AC 79 ms
76,704 KB
testcase_19 AC 79 ms
77,220 KB
testcase_20 AC 61 ms
71,472 KB
testcase_21 AC 579 ms
76,860 KB
権限があれば一括ダウンロードができます

ソースコード

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