結果

問題 No.1747 Many Formulae 2
コンテスト
ユーザー ys
提出日時 2022-03-09 02:22:56
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 72 ms / 2,000 ms
+ 426µs
コード長 378 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 238 ms
コンパイル使用メモリ 96,620 KB
実行使用メモリ 84,096 KB
最終ジャッジ日時 2026-08-24 14:59:44
合計ジャッジ時間 3,290 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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