結果
問題 | No.910 素数部分列 |
ユーザー |
![]() |
提出日時 | 2022-02-10 17:07:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 83 ms / 1,000 ms |
コード長 | 360 bytes |
コンパイル時間 | 907 ms |
コンパイル使用メモリ | 82,344 KB |
実行使用メモリ | 84,608 KB |
最終ジャッジ日時 | 2024-06-25 23:40:37 |
合計ジャッジ時間 | 4,841 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 50 |
ソースコード
n = int(input())s = list(str(input()))ans = 0cnt1 = 0cnt9 = 0for c in s:if c == '3' or c == '5' or c == '7':ans += 1elif c == '9':if cnt1:cnt1 -= 1ans += 1else:cnt9 += 1else:cnt1 += 1q = cnt9//2ans += min(q, cnt1)cnt1 -= min(q, cnt1)ans += cnt1//2print(ans)