結果
問題 | No.3015 右に寄せろ! |
ユーザー |
|
提出日時 | 2025-01-25 14:34:38 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 42 ms / 2,000 ms |
コード長 | 420 bytes |
コンパイル時間 | 5,559 ms |
コンパイル使用メモリ | 272,764 KB |
実行使用メモリ | 7,184 KB |
最終ジャッジ日時 | 2025-01-25 23:23:44 |
合計ジャッジ時間 | 4,840 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge11 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
#include <bits/stdc++.h> #include <cstdlib> #include <math.h> using namespace std; using ll = long long; int main(){ string s; cin >> s; ll z=0; ll ans=0; for(auto i:s)z+=i=='0'; for(int i=0;i<s.size()-1;i++){ if(s[i]=='0')z--; else{ if(s[i+1]=='1'){ ans+=z; i++; } } } cout << ans << endl; return 0; }