結果
| 問題 |
No.910 素数部分列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-10-18 21:38:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 581 bytes |
| コンパイル時間 | 1,663 ms |
| コンパイル使用メモリ | 166,316 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-25 15:15:15 |
| 合計ジャッジ時間 | 3,082 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 WA * 28 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
string S;
cin >> S;
// 11, 19 を何個とることができるかを考える。
int counter = 0;
int ans = 0;
for (char s : S){
int x = s - '0';
if (x == 1){
++counter;
}else if (x == 9){
if (counter > 0){
--counter;
++ans;
}
}else{
++ans;
}
}
cout << ans + counter / 2 << endl;
return 0;
}