結果

問題 No.910 素数部分列
ユーザー brthyyjp
提出日時 2022-02-10 17:04:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 346 bytes
コンパイル時間 585 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 85,292 KB
最終ジャッジ日時 2024-06-25 23:38:28
合計ジャッジ時間 4,729 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = list(str(input()))

ans = 0
cnt1 = 0
cnt9 = 0
for c in s:
    if c == '3' or c == '5' or c == '7':
        ans += 1
    elif c == '9':
        if cnt1:
            cnt1 -= 1
            ans += 1
        else:
            cnt9 += 1
    else:
        cnt1 += 1
q, r = divmod(cnt1, 2)
ans += q
ans += min(cnt9//2, r)
print(ans)
0