結果

問題 No.910 素数部分列
ユーザー tktk_snsn
提出日時 2021-01-22 10:58:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 350 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 75,176 KB
最終ジャッジ日時 2024-12-26 05:43:17
合計ジャッジ時間 4,999 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()

one = 0
nine = 0
ans = 0
for s in S:
    if s == "1":
        if nine >= 2:
            nine -= 2
            ans += 1
        else:
            one += 1
    elif s == "9":
        if one:
            one -= 1
            ans += 1
        else:
            nine += 1
    else:
        ans += 1
ans += one // 2
print(ans)
0