結果

問題 No.1747 Many Formulae 2
ユーザー lloyzlloyz
提出日時 2021-11-19 21:32:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 467 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 76,576 KB
最終ジャッジ日時 2023-08-30 07:31:13
合計ジャッジ時間 2,826 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
70,992 KB
testcase_01 AC 69 ms
71,128 KB
testcase_02 AC 88 ms
76,576 KB
testcase_03 AC 70 ms
71,388 KB
testcase_04 AC 72 ms
71,288 KB
testcase_05 AC 71 ms
71,284 KB
testcase_06 AC 70 ms
71,224 KB
testcase_07 AC 79 ms
76,524 KB
testcase_08 AC 72 ms
71,160 KB
testcase_09 AC 73 ms
71,228 KB
testcase_10 AC 72 ms
71,084 KB
testcase_11 AC 73 ms
71,256 KB
testcase_12 AC 75 ms
71,312 KB
testcase_13 AC 72 ms
71,496 KB
testcase_14 AC 70 ms
71,132 KB
testcase_15 AC 88 ms
76,568 KB
testcase_16 AC 84 ms
76,368 KB
testcase_17 WA -
testcase_18 AC 76 ms
71,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()

n = len(S)
n -= 1
ans = 0
for bit in range(1 << n):
    pre = 0
    tmp = 0
    for i in range(n):
        if (bit >> i) & 1:
            tmp += int(S[pre:i + 1])
            pre = i + 1
        if i == n - 1:
            tmp += int(S[pre:])
    flag = True
    if tmp % 2 == 0:
        continue
    f = 3
    while f * f <= tmp:
        if tmp % f == 0:
            flag = False
            break
        f += 2
    if flag:
        ans += 1
print(ans)
0