結果
問題 | No.1747 Many Formulae 2 |
ユーザー | hir355 |
提出日時 | 2021-11-10 23:59:39 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 81 ms / 2,000 ms |
コード長 | 542 bytes |
コンパイル時間 | 312 ms |
コンパイル使用メモリ | 86,932 KB |
実行使用メモリ | 75,868 KB |
最終ジャッジ日時 | 2023-08-30 06:29:55 |
合計ジャッジ時間 | 2,628 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 72 ms
71,196 KB |
testcase_01 | AC | 72 ms
71,336 KB |
testcase_02 | AC | 81 ms
75,868 KB |
testcase_03 | AC | 69 ms
71,172 KB |
testcase_04 | AC | 73 ms
75,480 KB |
testcase_05 | AC | 69 ms
71,096 KB |
testcase_06 | AC | 72 ms
71,252 KB |
testcase_07 | AC | 73 ms
75,532 KB |
testcase_08 | AC | 70 ms
71,352 KB |
testcase_09 | AC | 69 ms
71,444 KB |
testcase_10 | AC | 70 ms
71,332 KB |
testcase_11 | AC | 75 ms
75,228 KB |
testcase_12 | AC | 70 ms
71,488 KB |
testcase_13 | AC | 69 ms
71,348 KB |
testcase_14 | AC | 70 ms
71,164 KB |
testcase_15 | AC | 81 ms
75,676 KB |
testcase_16 | AC | 77 ms
75,552 KB |
testcase_17 | AC | 69 ms
71,244 KB |
testcase_18 | AC | 70 ms
71,272 KB |
ソースコード
def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: while n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) return a s = list(map(int, input())) a = [(0, 0)] for d in s: tmp = [] for p, q in a: tmp.append((p + q, d)) tmp.append((p, q * 10 + d)) a = tmp[:] ans = 0 for p, q in tmp: if len(prime_factorize(p + q)) == 1: ans += 1 print(ans // 2)