結果
問題 | No.3015 右に寄せろ! |
ユーザー |
|
提出日時 | 2025-02-22 02:05:33 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 47 ms / 2,000 ms |
コード長 | 398 bytes |
コンパイル時間 | 3,655 ms |
コンパイル使用メモリ | 273,608 KB |
実行使用メモリ | 8,084 KB |
最終ジャッジ日時 | 2025-02-22 02:05:40 |
合計ジャッジ時間 | 6,171 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
#include<bits/stdc++.h>using namespace std;using ll = long long;#define all(a) begin(a) end(a)#define rep(i,a,b) for(ll i = a; i < (b); i++)int main(){string s;cin>> s;ll ans = 0;ll cnt = 0;rep(i,0,s.size()){if(s[i] == '0'){ans += cnt/2;if(cnt % 2) cnt--;}else{cnt++;}}cout << ans << endl;}