結果

問題 No.1747 Many Formulae 2
ユーザー nok0nok0
提出日時 2021-11-11 00:08:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 380 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 77,052 KB
最終ジャッジ日時 2023-08-30 06:29:58
合計ジャッジ時間 2,629 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,752 KB
testcase_01 AC 70 ms
71,828 KB
testcase_02 AC 87 ms
77,052 KB
testcase_03 AC 69 ms
71,728 KB
testcase_04 AC 74 ms
75,596 KB
testcase_05 AC 70 ms
71,784 KB
testcase_06 AC 70 ms
71,284 KB
testcase_07 AC 81 ms
76,676 KB
testcase_08 AC 69 ms
71,684 KB
testcase_09 AC 68 ms
71,516 KB
testcase_10 AC 71 ms
71,528 KB
testcase_11 AC 71 ms
71,592 KB
testcase_12 AC 70 ms
71,636 KB
testcase_13 AC 70 ms
71,652 KB
testcase_14 AC 70 ms
71,584 KB
testcase_15 AC 87 ms
77,008 KB
testcase_16 AC 80 ms
76,916 KB
testcase_17 AC 67 ms
71,676 KB
testcase_18 AC 68 ms
71,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_prime(x):
    if x == 1:
        return 0
    for i in range(2, int(x ** 0.5) + 1):
        if x % i == 0:
            return 0
    return 1


res = 0
s = input()
n = len(s)
for b in range(1 << (n - 1)):
    t = []
    for i in range(n):
        t.append(s[i])
        if i < n - 1 and b >> i & 1:
            t.append('+')
    res += is_prime(eval(''.join(t)))
print(res)
0