結果

問題 No.3015 右に寄せろ!
ユーザー elphe
提出日時 2025-02-11 17:48:29
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 1,009 ms
コンパイル使用メモリ 77,244 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-02-11 17:48:33
合計ジャッジ時間 2,715 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdint>

using namespace std;

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	
	static char S[2000001];
	cin >> S;

	int32_t i, l = 0;
	int64_t ans = 0;
	for (i = 0; ; ++i)
		switch (S[i])
		{
		case '0':
			ans += (i - l) >> 1;
			l += 1 + ((i - l) & 1);
			break;

		case '\0':
			cout << ans << '\n';
			return 0;
		}

	cerr << "Buffer overflow...\n";
	return -1;
}
0