結果
| 問題 | No.910 素数部分列 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-11-19 22:41:40 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 6 ms / 1,000 ms |
| + 28µs | |
| コード長 | 482 bytes |
| 記録 | |
| コンパイル時間 | 2,163 ms |
| コンパイル使用メモリ | 337,720 KB |
| 実行使用メモリ | 9,908 KB |
| 最終ジャッジ日時 | 2026-11-19 22:41:47 |
| 合計ジャッジ時間 | 6,130 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 52 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
cin >> n >> s;
int ans = 0, c1 = 0, c9 = 0;
for (char c : s) {
if (c == '3' or c == '5' or c == '7') ans++;
else if (c == '1') c1++;
else {
if (c1) {
c1--;
ans++;
}
else c9++;
}
}
int t = min(c1, c9/2);
ans += t + (c1-t)/2;
cout << ans << '\n';
return 0;
}