結果

問題 No.1747 Many Formulae 2
ユーザー tamato
提出日時 2021-11-19 21:23:13
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 608 bytes
コンパイル時間 475 ms
コンパイル使用メモリ 82,536 KB
実行使用メモリ 117,264 KB
最終ジャッジ日時 2024-12-31 20:44:28
合計ジャッジ時間 15,459 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 1 TLE * 4
権限があれば一括ダウンロードができます

ソースコード

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