0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2025-01-11 23:12:00 +00:00

P2708 硬币翻转

R42118336
This commit is contained in:
Baoshuo Ren 2020-11-18 18:08:10 +08:00 committed by Baoshuo Ren
parent b37a3d66b5
commit 486abc676e
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

19
problem/P2708/P2708.cpp Normal file
View File

@ -0,0 +1,19 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int ans = s.size() - 1;
for (int i = 1; i < s.size(); i++) {
if (s[i] == s[i - 1]) {
ans--;
}
}
if (s[s.size() - 1] == '0') {
ans++;
}
cout << ans << endl;
return 0;
}