結果
| 問題 |
No.910 素数部分列
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-04-11 16:53:19 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 57 ms / 1,000 ms |
| コード長 | 352 bytes |
| コンパイル時間 | 294 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 75,932 KB |
| 最終ジャッジ日時 | 2024-06-27 11:36:16 |
| 合計ジャッジ時間 | 4,589 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 50 |
ソースコード
n = int(input())
s = input()
for i in "357":
s = s.replace(i,"")
ans = n - len(s)
#11,19,991
one = nine = 0
for i,si in enumerate(s):
if si == "1":
one += 1
else:
if one:
ans += 1
one -= 1
else:
nine += 1
c = min(one,nine//2)
ans += c
one -= c
nine -= 2*c
ans += one//2
print(ans)
convexineq