結果

問題 No.1747 Many Formulae 2
ユーザー tamatotamato
提出日時 2021-11-19 21:23:13
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 608 bytes
コンパイル時間 1,115 ms
コンパイル使用メモリ 87,468 KB
実行使用メモリ 75,672 KB
最終ジャッジ日時 2023-08-30 07:11:48
合計ジャッジ時間 5,539 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,896 KB
testcase_01 AC 74 ms
75,672 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    def is_prime(n):
        res = 1
        for i in range(2, n-1):
            if n % i == 0:
                res = 0
        return res

    S = input().rstrip('\n')
    N = len(S)

    ans = 0
    for i in range(1 << (N - 1)):
        st = []
        for j in range(N-1):
            st.append(S[j])
            if i >> j & 1:
                st.append("+")
        st.append(S[-1])
        a = eval("".join(st))
        if is_prime(a):
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()
0