結果

問題 No.3015 右に寄せろ!
ユーザー nu50218
提出日時 2025-01-25 12:36:37
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 750 bytes
コンパイル時間 3,656 ms
コンパイル使用メモリ 294,080 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-01-25 22:05:35
合計ジャッジ時間 5,153 ms
ジャッジサーバーID
(参考情報)
judge7 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#ifdef LOCAL
#include <local.hpp>
#else
#pragma GCC optimize("O3")
// #pragma target("arch=skylake-avx512")
#include <bits/stdc++.h>
#define debug(...) ((void)0)
#endif

using namespace std;
using ll = long long;
using ld = long double;

void solve(int) {
    string S;
    cin >> S;

    const int N = S.size();

    ll ans = 0;
    ll cnt = 0;
    for (int i = N - 2; i >= 0; i--) {
        if (S[i] == '1' && S[i + 1] == '1') {
            cnt += 2;
            ans += ((N - cnt) - i);
            i--;
        }
    }
    cout << ans << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++) {
        solve(i);
    }

#ifdef LOCAL
    postprocess();
#endif
}
0