結果

問題 No.1747 Many Formulae 2
ユーザー ysys
提出日時 2022-03-09 02:22:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 378 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 77,072 KB
最終ジャッジ日時 2023-10-09 22:08:41
合計ジャッジ時間 2,579 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,556 KB
testcase_01 AC 64 ms
71,820 KB
testcase_02 AC 73 ms
77,072 KB
testcase_03 AC 66 ms
71,616 KB
testcase_04 AC 70 ms
75,896 KB
testcase_05 AC 65 ms
71,356 KB
testcase_06 AC 66 ms
71,840 KB
testcase_07 AC 76 ms
76,772 KB
testcase_08 AC 66 ms
71,504 KB
testcase_09 AC 63 ms
71,884 KB
testcase_10 AC 66 ms
71,556 KB
testcase_11 AC 65 ms
71,720 KB
testcase_12 AC 66 ms
71,760 KB
testcase_13 AC 62 ms
71,584 KB
testcase_14 AC 62 ms
71,788 KB
testcase_15 AC 81 ms
77,036 KB
testcase_16 AC 73 ms
76,864 KB
testcase_17 AC 64 ms
71,524 KB
testcase_18 AC 65 ms
71,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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