結果
問題 |
No.3015 右に寄せろ!
|
ユーザー |
|
提出日時 | 2025-01-25 13:36:14 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 558 bytes |
コンパイル時間 | 3,192 ms |
コンパイル使用メモリ | 274,224 KB |
実行使用メモリ | 7,060 KB |
最終ジャッジ日時 | 2025-01-25 22:51:34 |
合計ジャッジ時間 | 4,537 ms |
ジャッジサーバーID (参考情報) |
judge9 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 WA * 27 |
ソースコード
#include <bits/stdc++.h> typedef long long ll; typedef std::pair<long long, long long> P; typedef std::priority_queue<P, std::vector<P>, std::greater<P>> PQ; int main() { std::string s; std::cin >> s; int n = s.length(); ll ans = 0; int count = 0; for (int i = n - 1; i >= 1; --i) { if (s[i] == '0') count++; else { if (s[i - 1] == '1') { ans += count; --i; } else { count = 0; } } } std::cout << ans << std::endl; }