結果

問題 No.910 素数部分列
コンテスト
ユーザー OKCH3COOH
提出日時 2019-10-26 21:43:12
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 471 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 301 ms
コンパイル使用メモリ 21,412 KB
実行使用メモリ 17,408 KB
最終ジャッジ日時 2026-08-27 08:48:21
合計ジャッジ時間 9,282 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import Counter

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

A = []
ans = 0

# 11, 19, 991

for s in S:
    if s == '3' or s == '5' or s == '7':
        ans += 1
    else:
        A.append(s)

one = 0
nine = 0
for s in A:
    if s == '1':
        if nine >= 2:
            ans += 1
            nine -= 2
        else:
            one += 1
    else:
        if one > 0:
            ans += 1
            one -= 1
        else:
            nine += 1

print(ans + one // 2)
0