結果
問題 | No.1747 Many Formulae 2 |
ユーザー | kys |
提出日時 | 2021-11-19 21:28:53 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 107 ms / 2,000 ms |
コード長 | 977 bytes |
コンパイル時間 | 565 ms |
コンパイル使用メモリ | 86,864 KB |
実行使用メモリ | 76,816 KB |
最終ジャッジ日時 | 2023-08-30 07:24:49 |
合計ジャッジ時間 | 2,820 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 71 ms
71,416 KB |
testcase_01 | AC | 72 ms
71,264 KB |
testcase_02 | AC | 107 ms
76,816 KB |
testcase_03 | AC | 70 ms
71,072 KB |
testcase_04 | AC | 75 ms
75,716 KB |
testcase_05 | AC | 71 ms
71,072 KB |
testcase_06 | AC | 71 ms
71,408 KB |
testcase_07 | AC | 80 ms
76,240 KB |
testcase_08 | AC | 70 ms
71,576 KB |
testcase_09 | AC | 70 ms
71,460 KB |
testcase_10 | AC | 73 ms
71,216 KB |
testcase_11 | AC | 71 ms
71,348 KB |
testcase_12 | AC | 70 ms
71,156 KB |
testcase_13 | AC | 70 ms
71,436 KB |
testcase_14 | AC | 72 ms
71,440 KB |
testcase_15 | AC | 84 ms
76,652 KB |
testcase_16 | AC | 79 ms
76,412 KB |
testcase_17 | AC | 71 ms
71,288 KB |
testcase_18 | AC | 71 ms
71,216 KB |
ソースコード
import sys input = sys.stdin.readline def iinput(): return int(input()) def sinput(): return input().rstrip() def i0input(): return int(input()) - 1 def linput(): return list(input().split()) def liinput(): return list(map(int, input().split())) def miinput(): return map(int, input().split()) def li0input(): return list(map(lambda x: int(x) - 1, input().split())) def mi0input(): return map(lambda x: int(x) - 1, input().split()) INF = 10**20 MOD = 1000000007 S = sinput() N = len(S) - 1 if N == 0: if S == '2' or S == '3' or S == '5' or S == '7': print(1) else: print(0) exit() ans = 1 << N for i in range(1 << N): tmp = [S[0]] for j in range(N): if (i >> j) & 1: tmp.append(S[j + 1]) else: tmp[-1] += S[j + 1] res = 0 for t in tmp: res += int(t) tmp = 2 while tmp * tmp <= res: if res % tmp == 0: ans -= 1 break tmp += 1 print(ans)