結果
| 問題 | No.910 素数部分列 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-10-26 21:34:32 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 538 bytes |
| 記録 | |
| コンパイル時間 | 361 ms |
| コンパイル使用メモリ | 20,696 KB |
| 実行使用メモリ | 15,360 KB |
| 最終ジャッジ日時 | 2026-04-04 14:17:47 |
| 合計ジャッジ時間 | 8,215 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 WA * 22 |
ソースコード
from collections import Counter
N = int(input())
S = input()
one = 0
nine = 0
ans = 0
# 11, 19, 991
for s in S:
if s == '3' or s == '5' or s == '7':
ans += 1
else:
if s == '9':
if one > 0:
ans += 1
one -= 1
else:
nine += 1
elif s == '1':
if nine >= 2:
ans += 1
nine -= 2
else:
one += 1
add = min(nine // 2, one)
ans += add
one -= add
print(ans + one // 2)