結果
問題 | No.1747 Many Formulae 2 |
ユーザー | 👑 Kazun |
提出日時 | 2021-11-19 21:24:14 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 84 ms / 2,000 ms |
コード長 | 766 bytes |
コンパイル時間 | 2,375 ms |
コンパイル使用メモリ | 86,368 KB |
実行使用メモリ | 76,980 KB |
最終ジャッジ日時 | 2023-08-30 07:13:38 |
合計ジャッジ時間 | 2,807 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 72 ms
70,744 KB |
testcase_01 | AC | 72 ms
71,276 KB |
testcase_02 | AC | 84 ms
76,584 KB |
testcase_03 | AC | 71 ms
71,356 KB |
testcase_04 | AC | 72 ms
71,352 KB |
testcase_05 | AC | 71 ms
71,416 KB |
testcase_06 | AC | 70 ms
71,228 KB |
testcase_07 | AC | 79 ms
76,636 KB |
testcase_08 | AC | 72 ms
71,320 KB |
testcase_09 | AC | 73 ms
71,516 KB |
testcase_10 | AC | 72 ms
71,056 KB |
testcase_11 | AC | 74 ms
71,404 KB |
testcase_12 | AC | 72 ms
71,356 KB |
testcase_13 | AC | 75 ms
71,088 KB |
testcase_14 | AC | 72 ms
71,376 KB |
testcase_15 | AC | 84 ms
76,980 KB |
testcase_16 | AC | 82 ms
76,808 KB |
testcase_17 | AC | 73 ms
71,088 KB |
testcase_18 | AC | 73 ms
71,224 KB |
ソースコード
#素数判定 for long long def Is_Prime_for_long_long(N): if N<=1: return False if N==2 or N==7 or N==61: return True if N%2==0: return False d=N-1 while d%2==0: d//=2 for a in (2,7,61): t=d y=pow(a,t,N) while t!=N-1 and y!=1 and y!=N-1: y=(y*y)%N t<<=1 if y!=N-1 and t%2==0: return False return True #================================================== from itertools import product S=input() N=len(S) K=0 for p in product((0,1),repeat=N-1): X=0; Y=int(S[0]) for i in range(N-1): if p[i]==0: Y*=10; Y+=int(S[i+1]) else: X+=Y Y=int(S[i+1]) X+=Y if Is_Prime_for_long_long(X): K+=1 print(K)