結果
問題 | No.1747 Many Formulae 2 |
ユーザー |
![]() |
提出日時 | 2021-11-19 21:38:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 572 bytes |
コンパイル時間 | 251 ms |
コンパイル使用メモリ | 82,544 KB |
実行使用メモリ | 63,500 KB |
最終ジャッジ日時 | 2024-12-31 22:08:33 |
合計ジャッジ時間 | 1,821 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
""" """ import sys from sys import stdin def is_prime(x): if x == 1: return False for y in range(2,10**10): if y**2 > x: break if x % y == 0: return False return True S = list(map(int, list(input()) )) N = len(S) ans = 0 for i in range(2**(N-1)): s = 0 now = S[0] for j in range(N-1): if 2**j & i > 0: now *= 10 now += S[j+1] else: s += now now = S[j+1] s += now if is_prime(s): ans += 1 print (ans)