991D Codeforces
Bishwocks
Solution in c++
#include <iostream>
using namespace std;
int main()
{
int sol1=0;
string a,b;
cin>>a>>b;
int sz=a.size();
for(int i=0;i+1<sz;i++){
if(a[i]=='0' && b[i]=='0' && a[i+1]=='0' &&b[i+1]=='0'){sol1++; a[i]='O' ; b[i]='O' ; a[i+1]='O';}
else if(a[i]=='0' && b[i]=='0' && a[i+1]=='0'){sol1++; a[i]='O' ; b[i]='O' ; a[i+1]='O';}
else if(a[i]=='0' && b[i]=='0' && b[i+1]=='0'){sol1++; a[i]='O' ; b[i]='O' ; b[i+1]='O';}
else if(a[i]=='0' && a[i+1]=='0' &&b[i+1]=='0'){sol1++; a[i]='O' ; a[i+1]='O' ; b[i+1]='O';}
else if(b[i]=='0' && a[i+1]=='0' &&b[i+1]=='0'){sol1++; b[i+1]='O' ; b[i]='O' ; a[i+1]='O';}
}
cout<<sol1<<"\n";
return 0;
}
0 التعليقات:
إرسال تعليق