結果

問題 No.1747 Many Formulae 2
ユーザー roarisroaris
提出日時 2021-11-19 21:57:53
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 1,887 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 77,928 KB
最終ジャッジ日時 2023-08-30 08:21:32
合計ジャッジ時間 6,568 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
71,476 KB
testcase_01 AC 97 ms
76,804 KB
testcase_02 AC 98 ms
77,888 KB
testcase_03 AC 88 ms
71,844 KB
testcase_04 AC 95 ms
77,332 KB
testcase_05 AC 88 ms
71,848 KB
testcase_06 AC 89 ms
71,920 KB
testcase_07 AC 128 ms
77,552 KB
testcase_08 AC 88 ms
71,480 KB
testcase_09 AC 88 ms
71,680 KB
testcase_10 AC 88 ms
71,844 KB
testcase_11 AC 89 ms
71,640 KB
testcase_12 AC 94 ms
77,016 KB
testcase_13 AC 88 ms
71,492 KB
testcase_14 AC 88 ms
71,672 KB
testcase_15 AC 1,887 ms
77,928 KB
testcase_16 AC 1,883 ms
77,872 KB
testcase_17 AC 89 ms
71,776 KB
testcase_18 AC 90 ms
71,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

s = list(input()[:-1])
n = len(s)
ans = 0

for S in range(1<<(n-1)):
    num = 0
    now = 0
    
    for i in range(n):
        now = 10*now+int(s[i])
        
        if (S>>i)&1:
            num += now
            now = 0
    
    num += now
    
    if num==1:
        continue
    
    for i in range(2, num):
        if num%i==0:
            break
    else:
        ans += 1

print(ans)
0