結果
問題 | No.3015 右に寄せろ! |
ユーザー |
![]() |
提出日時 | 2025-01-25 13:15:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 47 ms / 2,000 ms |
コード長 | 555 bytes |
コンパイル時間 | 2,113 ms |
コンパイル使用メモリ | 160,056 KB |
実行使用メモリ | 7,056 KB |
最終ジャッジ日時 | 2025-01-25 22:40:02 |
合計ジャッジ時間 | 3,664 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge8 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<long long> VL; typedef vector<VL> VVL; typedef long long LL; #define all(a) (a).begin(), (a).end() #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define ALL(a) (a).begin(),(a).end() #define pb push_back int main() { string s;cin>>s; int n=s.size(); LL ans=0; int a=0; rep(i,n){ if(s[i]=='1'){a++;} else{ ans+=a/2; a=a/2*2; } } cout<<ans<<endl; }