結果
問題 | No.1747 Many Formulae 2 |
ユーザー |
|
提出日時 | 2021-11-19 22:20:06 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 603 bytes |
コンパイル時間 | 199 ms |
コンパイル使用メモリ | 12,288 KB |
実行使用メモリ | 10,240 KB |
最終ジャッジ日時 | 2025-01-01 18:48:38 |
合計ジャッジ時間 | 1,679 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
from sys import stdindef is_prime(n):if n == 2:return Trueif n == 1 or not n % 2:return Falsem = int(n ** 0.5) + 1for i in range(3, m, 2):if not n % i:return Falsereturn Truedef main():input = lambda: stdin.readline()[:-1]S = input()n = len(S) - 1ans = 0for mask in range(1 << n):i, num = 0, 0for j in range(n):if mask & 1 << j:num += int(S[i : j + 1])i = j + 1num += int(S[i:])ans += is_prime(num)print(ans)main()