結果

問題 No.1747 Many Formulae 2
ユーザー pypypymipypypymi
提出日時 2022-02-24 22:52:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 1,170 ms
コンパイル使用メモリ 86,752 KB
実行使用メモリ 76,724 KB
最終ジャッジ日時 2023-09-15 10:15:24
合計ジャッジ時間 7,447 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,416 KB
testcase_01 AC 74 ms
75,320 KB
testcase_02 AC 108 ms
76,724 KB
testcase_03 AC 71 ms
71,264 KB
testcase_04 AC 76 ms
76,340 KB
testcase_05 AC 71 ms
71,432 KB
testcase_06 AC 71 ms
71,360 KB
testcase_07 AC 112 ms
76,216 KB
testcase_08 AC 73 ms
71,320 KB
testcase_09 AC 72 ms
71,316 KB
testcase_10 AC 72 ms
71,444 KB
testcase_11 AC 78 ms
75,840 KB
testcase_12 AC 74 ms
75,636 KB
testcase_13 AC 72 ms
71,428 KB
testcase_14 AC 71 ms
71,372 KB
testcase_15 AC 1,686 ms
76,700 KB
testcase_16 AC 1,661 ms
76,204 KB
testcase_17 AC 70 ms
71,340 KB
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
s = list(input())
s_space = list(" ".join(s))
result = []
lis=list(range(0,len(s)-1))

def judge(n):
    for i in range(2,n):
        if n%i==0:
            return 0
    return 1
        


for n in range(0,len(lis)+1):
    for conb in itertools.combinations(lis, n):
        result.append(list(conb))
count = 0        
for i in result:
    s_v = s_space.copy()
    for j in i:
        s_v[j*2+1]="+"
    v = eval("".join(list(filter(lambda x:x!=" ",s_v))))
    count += judge(v)
print(count)
        
    
0