結果

問題 No.910 素数部分列
ユーザー kohei2019
提出日時 2022-08-03 01:28:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 334 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 82,444 KB
実行使用メモリ 103,440 KB
最終ジャッジ日時 2024-07-23 19:40:37
合計ジャッジ時間 5,371 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
lsS = list(map(int,list(input())))
cnt = 0
lsS1 = []
pS = set([3,5,7])
for i in range(N):
    if lsS[i] in pS:
        cnt += 1
    else:
        lsS1.append(lsS[i])
cn1 = 0
for s in lsS1:
    if s == 1:
        cn1 += 1
    else:
        if cn1 > 0:
            cnt += 1
            cn1 -= 1
cnt += cn1//2
print(cnt)
0