結果

問題 No.910 素数部分列
ユーザー rlangevin
提出日時 2023-01-27 20:45:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 445 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 86,784 KB
最終ジャッジ日時 2024-06-28 05:58:22
合計ジャッジ時間 5,132 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = list(input())
S = list(map(int, S))
ans = S.count(3) + S.count(5) + S.count(7)
one = 0
nine = 0
for s in S:
    if s == 1:
        if nine >= 2:
            ans += 1
            nine -= 2
        else:
            one += 1
    elif s == 9:
        if one:
            ans += 1
            one -= 1
        else:
            nine += 1
print(ans + one//2)
0