結果

問題 No.1747 Many Formulae 2
ユーザー roarisroaris
提出日時 2021-11-19 22:25:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 469 bytes
コンパイル時間 439 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 78,408 KB
最終ジャッジ日時 2023-08-30 09:08:45
合計ジャッジ時間 3,254 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,816 KB
testcase_01 AC 109 ms
72,204 KB
testcase_02 AC 106 ms
78,184 KB
testcase_03 AC 94 ms
72,104 KB
testcase_04 AC 102 ms
77,300 KB
testcase_05 AC 94 ms
72,068 KB
testcase_06 AC 95 ms
72,184 KB
testcase_07 AC 104 ms
77,724 KB
testcase_08 AC 94 ms
72,384 KB
testcase_09 AC 93 ms
72,260 KB
testcase_10 AC 93 ms
72,204 KB
testcase_11 AC 96 ms
72,000 KB
testcase_12 AC 95 ms
71,988 KB
testcase_13 AC 97 ms
72,008 KB
testcase_14 AC 97 ms
71,912 KB
testcase_15 AC 110 ms
78,408 KB
testcase_16 AC 108 ms
78,012 KB
testcase_17 AC 95 ms
72,108 KB
testcase_18 AC 94 ms
71,580 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, int(num**0.5)+1):
        if num%i==0:
            break
    else:
        ans += 1

print(ans)
0