結果

問題 No.3015 右に寄せろ!
ユーザー sig_256
提出日時 2025-01-25 14:17:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 260 bytes
コンパイル時間 862 ms
コンパイル使用メモリ 66,984 KB
実行使用メモリ 7,532 KB
最終ジャッジ日時 2025-01-25 23:14:54
合計ジャッジ時間 2,401 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

int main(){
	std::string S;
	std::cin >> S;
	long long ans = 0, onelength = 0;
	for(char c : S){
		if(c == '1'){
			onelength++;
			continue;
		}
		ans += onelength >>= 1;
		onelength <<= 1;
	}
	std::cout << ans << std::endl;
	return 0;
}
0