問題一覧 > 通常問題

No.3015 右に寄せろ!

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 157
作問者 : ngtkana / テスター : ゆにたりー卿 👑 binap DeltaStruct Apollo@Kuro Yama.can Rice_tawara459 のらら あじゃじゃ eom2357
お気に入りにしたユーザー ProblemId : 11633 / 自分の提出
問題文最終更新日: 2025-01-26 22:07:43
Shift to the Right!
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
第1回 岩井星人アンソロジープログラミングコンテスト (順位表) の他の問題:

Problem Statement

Iwai Seijin loves things shifted to the right, and is especially fond of the operation of changing a substring 110 of a string into 011.

Given a string $S$, find the maximum number of times Iwai Seijin can perform this operation.

Constraints

  • $S$ is a string of length at least $1$ and at most $2 \times 10 ^ 6$
  • $S$ consists of 0 and 1

Input

The input is given from Standard Input in the following format.

$S$

Output

Output the maximum number of operations that can be performed.

Sample

Sample 1
Input
10110110
Output
3

The string can be changed as 10110110 → 10011110 → 10011011 → 10001111.

Sample 2
Input
0000000010000001111
Output
0

Iwai Seijin cannot shift to the right any further.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。