Problem - A122 - Codeforces
Problem - A122 - Codeforces
Enter | Register
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN
Codeforces Blitz Cup 2025 Final Rounds Have Started! Join the stream now: https://youtu.be/rbHFLNg7Nkc. ×
PROBLEMS SUBMIT CODE MY SUBMISSIONS STATUS HACKS ROOM STANDINGS CUSTOM INVOCATION
Calculate the minimum number of operations required to change all characters in s to 0. Register for practice
Example
Start virtual contest
input Copy
https://codeforces.com/contest/2062/problem/A 1/2
3/9/25, 10:20 PM Problem - A - Codeforces
5 → Problem tags
1
000
constructive algorithms greedy math
1001
10101 strings *800
01100101011101 No tag edit access
output Copy
1 → Contest materials
0
2
Announcement (en)
3
8 Tutorial (en)
Note
In the first test case, you can flip s1 . Then s becomes 0, so the answer is 1.
In the fourth test case, you can perform the following three operations in order:
It can be shown that you can not change all characters in s to 0 in less than three operations, so the
answer is 3.
Supported by
https://codeforces.com/contest/2062/problem/A 2/2