結果
問題 |
No.910 素数部分列
|
ユーザー |
![]() |
提出日時 | 2019-10-18 22:16:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 461 bytes |
コンパイル時間 | 1,569 ms |
コンパイル使用メモリ | 166,096 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-25 17:11:34 |
合計ジャッジ時間 | 3,076 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 37 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int num[2] = {}; int ans = 0; for(char c : s) { if(c == '3' or c == '5' or c == '7') { ++ans; } else { if(num[0] > 0) { ++ans; --num[0]; } else { if(c == '1') { if(num[1] >= 2) { num[1] -= 2; ++ans; } else { ++num[0]; } } else { ++num[1]; } } } } cout << ans << endl; return 0; }