結果

問題 No.1747 Many Formulae 2
コンテスト
ユーザー ys
提出日時 2022-03-09 02:22:56
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 43 ms / 2,000 ms
+ 775µs
コード長 378 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 84 ms
コンパイル使用メモリ 65,364 KB
実行使用メモリ 60,068 KB
最終ジャッジ日時 2026-10-14 20:05:39
合計ジャッジ時間 2,272 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

S = input()
if S == '1':
  print(0)
  exit()
N = len(S)
ans = 0
for i in range(1 << (N - 1)):
  res = 0
  tmp = S[0]
  for j in range(N - 1):
    if i & 1 << j:
      res += int(tmp)
      tmp = S[j + 1]
    else:
      tmp += S[j + 1]
  if tmp != '':
    res += int(tmp)
  for j in range(2, int(res ** 0.5) + 1):
    if res % j == 0:
      break
  else:
    ans += 1
print(ans)
0