結果

問題 No.1747 Many Formulae 2
ユーザー hirafishhirafish
提出日時 2021-11-19 22:08:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 750 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 10,888 KB
実行使用メモリ 959,752 KB
最終ジャッジ日時 2023-08-30 08:41:15
合計ジャッジ時間 6,450 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
from itertools import product

s = input()

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

ss = set(seachPrimeNum(999999999))

lens = len(s)
bitl = list(product([False, True], repeat=lens-1))

ans = 0
for i in range(len(bitl)):
  eval_l = []
  for j in range(lens-1):
    if bitl[i][j]:
      eval_l.append(s[j])
      eval_l.append("+")
    else:
      eval_l.append(s[j])
  
  eval_l.append(s[-1])
  if eval("".join(eval_l)) in ss:
      ans += 1

print(ans)


0