https://codeforces.com/gym/580226/problem/F
#include<bits/stdc++.h>
#define lc p<<1
#define rc p<<1|1
#define INF 2e9
using namespace std;
#define endl '\n'
using ll = long long;
using pii = pair<ll, ll>;
const double PI = acos(-1);
const int N=2e5+10;
void solve(){
string s1,s2;cin>>s1>>s2;
int cnt=0;
for(int i=0;i<s1.size()-1;i++){
if(s1[i]=='0'&&s1[i+1]=='0'&&s2[i]=='0'){
s1[i]=s1[i+1]=s2[i]='X';
cnt++;
}
else if(s1[i]=='0'&&s1[i+1]=='0'&&s2[i+1]=='0'){
s1[i]=s1[i+1]=s2[i+1]='X';
cnt++;
}
else if(s1[i]=='0'&&s2[i]=='0'&&s2[i+1]=='0'){
s1[i]=s2[i]=s2[i+1]='X';
cnt++;
}
else if(s1[i+1]=='0'&&s2[i]=='0'&&s2[i+1]=='0'){
s1[i+1]=s2[i]=s2[i+1]='X';
cnt++;
}
else {
}
}
cout<<cnt;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
int T = 1;
// cin>>T;
while (T--) {
solve();
}
return 0;
}
标签:const,int,s2,s1,solve,字符串,图形
From: https://www.cnblogs.com/laileou/p/18667170