結果

問題 No.910 素数部分列
ユーザー lam6er
提出日時 2025-04-15 21:31:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 373 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 82,140 KB
実行使用メモリ 96,020 KB
最終ジャッジ日時 2025-04-15 21:33:47
合計ジャッジ時間 4,767 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 42
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input().strip()

count_1 = 0
rest = []

for c in s:
    if c in {'3', '5', '7'}:
        count_1 += 1
    else:
        rest.append(c)

count_2 = 0
i = 0
while i < len(rest) - 1:
    if (rest[i] == '1' and rest[i+1] == '1') or (rest[i] == '1' and rest[i+1] == '9'):
        count_2 += 1
        i += 2
    else:
        i += 1

print(count_1 + count_2)
0