結果
問題 |
No.1747 Many Formulae 2
|
ユーザー |
![]() |
提出日時 | 2021-11-19 22:08:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 750 bytes |
コンパイル時間 | 285 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 1,254,776 KB |
最終ジャッジ日時 | 2025-01-01 17:59:04 |
合計ジャッジ時間 | 44,330 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge7 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 16 MLE * 3 |
ソースコード
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)