結果

問題 No.3015 右に寄せろ!
ユーザー hamikan
提出日時 2025-09-05 22:14:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 376 bytes
コンパイル時間 2,214 ms
コンパイル使用メモリ 195,252 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-05 22:14:59
合計ジャッジ時間 4,277 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S;
    cin >> S;
    S += '1';
    reverse(S.begin(), S.end());
    long long cnt = 0, ans = 0;
    for(int i=1; i<S.length(); i++) {
        if(S[i-1] == '1' && S[i] == '1') ans += cnt;
        cnt += (S[i] == '0');
    }
    cout << ans << endl;
}
0