結果
問題 |
No.910 素数部分列
|
ユーザー |
|
提出日時 | 2022-04-17 16:04:20 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 470 bytes |
コンパイル時間 | 526 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 86,016 KB |
最終ジャッジ日時 | 2024-12-26 09:43:25 |
合計ジャッジ時間 | 7,009 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 WA * 22 |
ソースコード
""" 3 5 7 11 19 991 """ n = int(input()) S = input() lst = [] ans = 0 for s in S: if s in "357": ans += 1 elif s == "1": if len(lst) >= 2 and lst[-1] == 9 and lst[-2] == 9: ans += 1 lst.pop() lst.pop() else: lst.append(1) else: if lst and lst[-1] == 1: ans += 1 lst.pop() else: lst.append(9) c = lst.count(1) print(ans + c // 2)