結果

問題 No.1747 Many Formulae 2
ユーザー KudeKude
提出日時 2021-11-19 21:25:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 427 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 82,380 KB
実行使用メモリ 62,140 KB
最終ジャッジ日時 2024-12-31 20:51:56
合計ジャッジ時間 1,819 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_prime(x):
    i = 2
    while i * i <= x:
        if x % i == 0:
            return False
        i += 1
    return True

s = list(map(int, input()))
n = len(s)
ans = 0
for b in range(1 << n - 1):
    x = 0
    tmp = s[0]
    for i in range(n - 1):
        if b >> i & 1:
            x += tmp
            tmp = 0
        else:
            tmp *= 10
        tmp += s[i + 1]
    x += tmp
    ans += is_prime(x)

print(ans)
0