結果
| 問題 |
No.910 素数部分列
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 21:24:17 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 500 bytes |
| コンパイル時間 | 305 ms |
| コンパイル使用メモリ | 82,152 KB |
| 実行使用メモリ | 76,044 KB |
| 最終ジャッジ日時 | 2025-04-15 21:29:43 |
| 合計ジャッジ時間 | 4,103 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 43 |
ソースコード
n = int(input())
s = input()
from collections import defaultdict
count = defaultdict(int)
for c in s:
count[c] += 1
ans = 0
# Step 1: Count 1-digit primes (3, 5, 7)
ans += count['3'] + count['5'] + count['7']
count['3'] = 0
count['5'] = 0
count['7'] = 0
# Step 2: Form as many 11 as possible
x = count['1']
ans += x // 2
remaining_ones = x % 2
count['1'] = remaining_ones
# Step 3: Form primes with 1 and 9 (19)
possible_pairs = min(count['1'], count['9'])
ans += possible_pairs
print(ans)
lam6er