結果
| 問題 |
No.3015 右に寄せろ!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-25 13:21:25 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 930 bytes |
| コンパイル時間 | 3,254 ms |
| コンパイル使用メモリ | 276,056 KB |
| 実行使用メモリ | 7,184 KB |
| 最終ジャッジ日時 | 2025-01-25 22:44:27 |
| 合計ジャッジ時間 | 5,079 ms |
|
ジャッジサーバーID (参考情報) |
judge9 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 WA * 27 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef local
#include <debug.hpp>
#else
#define debug(...)
#endif
#define rep(i, n) for (int i = 0; i < n; i++)
template <class T> istream& operator>>(istream& I, vector<T>& V) {for (T& X : V) I >> X; return I;}
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
vector<int> di = {-1, 1, 0, 0}, dj = {0, 0, -1, 1}; int inf = 2e9; long INF = 1e18;
int main() {
string s;
cin >> s;
int n = s.size();
int x = 0;
long ans = 0;
for (int i = n - 1; i > 0; i--) {
if (s[i] == '1') {
if (s[i - 1] == '1') {
ans += x;
i--;
} else {
x = 0;
}
} else {
x++;
}
}
cout << ans << endl;
return 0;
}