結果
問題 | No.3015 右に寄せろ! |
ユーザー |
|
提出日時 | 2025-02-01 20:23:13 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 381 bytes |
コンパイル時間 | 4,361 ms |
コンパイル使用メモリ | 274,852 KB |
実行使用メモリ | 5,488 KB |
最終ジャッジ日時 | 2025-02-01 20:23:19 |
合計ジャッジ時間 | 5,763 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); string S; cin >> S; long long ans = 0; int cnt = 0; for(int i = 0; i < (int)S.size(); i++) { if(S[i] == '1') cnt++; else { ans += cnt / 2; cnt -= cnt % 2; } } cout << ans << endl; }