結果

問題 No.3015 右に寄せろ!
ユーザー eve__fuyuki
提出日時 2025-01-31 22:35:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 2,245 ms
コンパイル使用メモリ 192,324 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-31 22:35:39
合計ジャッジ時間 3,834 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

void fast_io() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
}

int main() {
	fast_io();
	string s;
	cin >> s;
	long long ans = 0;
	int i = 0;
	for (char c : s) {
		if (c == '1') {
			i++;
		} else {
			ans += i / 2;
			i -= i % 2;
		}
	}
	cout << ans << endl;
}
0