結果
問題 |
No.3114 0→1
|
ユーザー |
|
提出日時 | 2025-04-19 17:24:04 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 356 bytes |
コンパイル時間 | 3,618 ms |
コンパイル使用メモリ | 273,224 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-04-19 17:24:09 |
合計ジャッジ時間 | 4,840 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | WA * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n; string s ; cin >> n >> s; int sum = 0; for(int i = 0; i < n - 2; i++) { if(s[i] == '0' && s[i + 2] == '0') { sum++; s[i + 2] = '1'; } } for(int i = 0; i < n - 1; i++) { if(s[i] == '0' && s[i + 1] == '0') { sum++; s[i + 1] = '1'; } } cout << sum << endl; }