結果

問題 No.1747 Many Formulae 2
ユーザー tamatotamato
提出日時 2021-11-19 21:24:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 656 bytes
コンパイル時間 1,218 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 76,920 KB
最終ジャッジ日時 2023-08-30 07:13:16
合計ジャッジ時間 2,989 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,616 KB
testcase_01 AC 73 ms
71,536 KB
testcase_02 AC 100 ms
76,920 KB
testcase_03 AC 74 ms
71,544 KB
testcase_04 AC 79 ms
75,820 KB
testcase_05 AC 73 ms
71,804 KB
testcase_06 AC 73 ms
71,732 KB
testcase_07 AC 83 ms
76,636 KB
testcase_08 AC 75 ms
71,536 KB
testcase_09 AC 73 ms
71,332 KB
testcase_10 AC 77 ms
75,780 KB
testcase_11 AC 81 ms
75,968 KB
testcase_12 AC 73 ms
71,804 KB
testcase_13 AC 70 ms
71,692 KB
testcase_14 AC 70 ms
71,644 KB
testcase_15 AC 93 ms
76,840 KB
testcase_16 AC 82 ms
76,524 KB
testcase_17 AC 70 ms
71,652 KB
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

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 i * i > n:
                break
            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