結果
問題 | No.3015 右に寄せろ! |
ユーザー |
|
提出日時 | 2025-01-25 13:42:31 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 47 ms / 2,000 ms |
コード長 | 520 bytes |
コンパイル時間 | 3,337 ms |
コンパイル使用メモリ | 273,164 KB |
実行使用メモリ | 8,180 KB |
最終ジャッジ日時 | 2025-01-25 22:56:45 |
合計ジャッジ時間 | 4,967 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
#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 = 0; i < n; ++i) { if (s[i] == '1') count++; else { if (s[i] == '0') { ans += count / 2; count -= count % 2; } } } std::cout << ans << std::endl; }