結果

問題 No.910 素数部分列
ユーザー gew1fw
提出日時 2025-06-12 16:42:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 425 bytes
コンパイル時間 450 ms
コンパイル使用メモリ 81,844 KB
実行使用メモリ 96,068 KB
最終ジャッジ日時 2025-06-12 16:42:36
合計ジャッジ時間 4,596 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input().strip()

count_357 = 0
remaining = []
for c in s:
    if c in {'3', '5', '7'}:
        count_357 += 1
    else:
        remaining.append(c)

count_1 = 0
count_19 = 0
for c in remaining:
    if c == '1':
        count_1 += 1
    elif c == '9':
        if count_1 > 0:
            count_19 += 1
            count_1 -= 1

count_11 = count_1 // 2
total = count_357 + count_19 + count_11

print(total)
0