結果

問題 No.3015 右に寄せろ!
ユーザー eve__fuyuki
提出日時 2025-01-31 22:33:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 372 bytes
コンパイル時間 2,330 ms
コンパイル使用メモリ 194,392 KB
実行使用メモリ 19,260 KB
最終ジャッジ日時 2025-01-31 22:34:31
合計ジャッジ時間 40,958 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25 TLE * 11
権限があれば一括ダウンロードができます

ソースコード

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;
	int n = s.size();
	int ans = 0;
	for (int i = 2; i < n; i++) {
		int j = i;
		while (j >= 2 && s.substr(j - 2, 3) == "110") {
			swap(s[j], s[j - 2]);
			j -= 2;
			ans++;
		}
	}
	cout << ans << endl;
}
0