結果

問題 No.1747 Many Formulae 2
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-11-19 22:36:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 92 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 87,332 KB
実行使用メモリ 77,212 KB
最終ジャッジ日時 2023-08-30 09:24:16
合計ジャッジ時間 2,997 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,720 KB
testcase_01 AC 76 ms
71,856 KB
testcase_02 AC 91 ms
77,092 KB
testcase_03 AC 73 ms
71,624 KB
testcase_04 AC 79 ms
76,408 KB
testcase_05 AC 73 ms
71,860 KB
testcase_06 AC 77 ms
71,704 KB
testcase_07 AC 86 ms
76,584 KB
testcase_08 AC 72 ms
71,628 KB
testcase_09 AC 76 ms
71,612 KB
testcase_10 AC 77 ms
71,608 KB
testcase_11 AC 78 ms
71,768 KB
testcase_12 AC 77 ms
71,724 KB
testcase_13 AC 75 ms
71,728 KB
testcase_14 AC 74 ms
71,752 KB
testcase_15 AC 92 ms
77,212 KB
testcase_16 AC 84 ms
76,600 KB
testcase_17 AC 77 ms
71,944 KB
testcase_18 AC 74 ms
71,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = list(input())
for i in range(len(S)):
    S[i] = int(S[i])
ans = 0
for i in range(1<<len(S)-1):
    num = 0
    now = S[0]
    for j in range(len(S)-1):
        if i >> j & 1:
            num += now
            now = S[j+1]
        else:
            now *= 10
            now += S[j+1]
    num += now
    prime = 1
    for j in range(2,int(num**0.5)+1):
        if num%j == 0:
            prime = 0
            break
    if num == 1:
        prime = 0
    ans += prime
print(ans)
0