結果
| 問題 | No.910 素数部分列 |
| コンテスト | |
| ユーザー |
hrbt__
|
| 提出日時 | 2019-11-26 19:53:47 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 603 bytes |
| 記録 | |
| コンパイル時間 | 92 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 12,772 KB |
| 最終ジャッジ日時 | 2024-11-07 00:53:32 |
| 合計ジャッジ時間 | 4,635 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 WA * 31 |
ソースコード
#!/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
nine = 0
one_nine = 0
for c in s[::-1]:
if c == '1':
if nine > 0:
ans += 1
nine -= 1
elif one > 0:
ans += 1
one -= 1
else:
one += 1
if c == '9':
if one_nine > 0:
ans += 1
nine -= 2
one_nine -= 1
elif one > 0:
nine += 1
one_nine += 1
else:
nine += 1
print(ans)
hrbt__