結果

問題 No.1747 Many Formulae 2
ユーザー V_MelvilleV_Melville
提出日時 2021-11-20 02:32:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 731 ms
コンパイル使用メモリ 10,612 KB
実行使用メモリ 7,908 KB
最終ジャッジ日時 2023-08-30 16:08:05
合計ジャッジ時間 1,974 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,776 KB
testcase_01 AC 16 ms
7,880 KB
testcase_02 AC 24 ms
7,740 KB
testcase_03 AC 16 ms
7,776 KB
testcase_04 AC 17 ms
7,776 KB
testcase_05 AC 16 ms
7,764 KB
testcase_06 AC 16 ms
7,880 KB
testcase_07 AC 20 ms
7,776 KB
testcase_08 AC 16 ms
7,736 KB
testcase_09 AC 16 ms
7,696 KB
testcase_10 AC 17 ms
7,836 KB
testcase_11 AC 18 ms
7,812 KB
testcase_12 AC 17 ms
7,692 KB
testcase_13 AC 17 ms
7,876 KB
testcase_14 AC 16 ms
7,908 KB
testcase_15 AC 26 ms
7,696 KB
testcase_16 AC 21 ms
7,876 KB
testcase_17 AC 16 ms
7,876 KB
testcase_18 AC 16 ms
7,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


s = input()
n = len(s)
ans = 0
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('+')
    ans += is_Prime(eval(''.join(t)))
print(ans)
0