結果

問題 No.1747 Many Formulae 2
ユーザー SidewaysOwlSidewaysOwl
提出日時 2021-11-19 21:26:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 406 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 76,664 KB
最終ジャッジ日時 2023-08-30 07:21:03
合計ジャッジ時間 2,869 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,472 KB
testcase_01 AC 69 ms
71,276 KB
testcase_02 AC 94 ms
76,664 KB
testcase_03 AC 68 ms
71,080 KB
testcase_04 AC 75 ms
75,548 KB
testcase_05 AC 68 ms
71,412 KB
testcase_06 AC 69 ms
71,384 KB
testcase_07 AC 79 ms
76,324 KB
testcase_08 AC 68 ms
71,316 KB
testcase_09 AC 68 ms
71,292 KB
testcase_10 AC 74 ms
75,688 KB
testcase_11 AC 76 ms
75,480 KB
testcase_12 AC 68 ms
71,456 KB
testcase_13 AC 69 ms
71,080 KB
testcase_14 AC 72 ms
71,392 KB
testcase_15 AC 89 ms
76,624 KB
testcase_16 AC 80 ms
76,268 KB
testcase_17 AC 69 ms
71,272 KB
testcase_18 AC 68 ms
71,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
n = len(s)-1
def cul(m):
    if m == 1:
        return False
    res = True
    cnt = 2
    while cnt ** 2 <= m:
        if m % cnt == 0:
            res = False
        cnt += 1
    return res
ans = 0
for i in range(1 << n):
    res = s[0]
    for j in range(n):
        if i & (1 << j):
            res += "+"
        res += s[j+1]
    m = eval(res)
    if cul(m):
        ans += 1
print(ans)
0