結果
問題 |
No.910 素数部分列
|
ユーザー |
![]() |
提出日時 | 2025-06-12 21:19:28 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 524 bytes |
コンパイル時間 | 247 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 95,744 KB |
最終ジャッジ日時 | 2025-06-12 21:19:53 |
合計ジャッジ時間 | 5,610 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 42 |
ソースコード
n = int(input()) s = input().strip() count_singles = 0 remaining = [] for c in s: if c in {'3', '5', '7'}: count_singles += 1 else: remaining.append(c) unpaired_1 = 0 count_pairs = 0 for c in remaining: if c == '1': if unpaired_1 > 0: count_pairs += 1 unpaired_1 = 0 else: unpaired_1 += 1 elif c == '9': if unpaired_1 > 0: count_pairs += 1 unpaired_1 = 0 total = count_singles + count_pairs print(total)