結果

問題 No.910 素数部分列
ユーザー hrbt__
提出日時 2019-11-26 19:23:55
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 389 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-11-07 00:52:50
合計ジャッジ時間 5,329 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 42
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
n = int(input())
s = input()
s = ''.join(s.split('3'))
s = ''.join(s.split('5'))
s = ''.join(s.split('7'))
ans = n - len(s)
one = 0
for i in range(len(s)):
    if s[i] == '1':
        if one > 0:
            ans += 1
            one -= 1
        else:
            one += 1
    if s[i] == '9':
        if one > 0:
            ans += 1
            one -= 1
print(ans)
0