結果

問題 No.3015 右に寄せろ!
ユーザー Hyoka7
提出日時 2025-01-25 13:21:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 560 bytes
コンパイル時間 2,077 ms
コンパイル使用メモリ 194,332 KB
実行使用メモリ 19,068 KB
最終ジャッジ日時 2025-01-25 22:44:30
合計ジャッジ時間 39,741 ms
ジャッジサーバーID
(参考情報)
judge7 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 1 TLE * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(a, b, c) for (int a = b; a < (int)c; ++a)

vector<int> xm = {-1, 1, 0, 0};
vector<int> ym = {0, 0, 1, -1};

const ll MOD = 998244353;

int main()
{
    string s;
    cin >> s;
    int ans = 0;
    rep(i, 0, s.size() - 2)
    {
        if (s[i] == '1' && s[i + 1] == '1' && s[i + 2] == '0')
        {
            ans++;
            s[i] = '0', s[i + 1] = '1', s[i + 2] = '1';
            i = max(0, i - 4);
        }
    }
    cout << ans << endl;
}
0