結果
問題 | No.910 素数部分列 |
ユーザー |
![]() |
提出日時 | 2020-02-27 13:14:00 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 106 ms / 1,000 ms |
コード長 | 533 bytes |
コンパイル時間 | 129 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 12,520 KB |
最終ジャッジ日時 | 2024-10-13 15:52:17 |
合計ジャッジ時間 | 5,032 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 50 |
ソースコード
#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # %% N = int(readline()) S = read().rstrip().decode() # %% S = S.replace('3', '') S = S.replace('5', '') S = S.replace('7', '') answer = N - len(S) # %% T = [0] for x in map(int, S): if x == 9 and T[-1] == 1: answer += 1 T.pop() else: T.append(x) x9 = T.count(9) x1 = T.count(1) n = min(x9 // 2, x1) answer += n x1 -= n answer += x1 // 2 print(answer)