B. MIN-MEX Cut
出现0的,贡献+1,出现1,则进行判断,要和0搭配使用
int cnt=0;
string s;
cin>>s;
s="1"+s;
for(int i=1; i<s.size(); i++)
{
if(s[i-1]=='0') cnt++;
if(s[i-1]=='1' && s[i]=='0') cnt++;
}
cout<<(2>cnt ? 2 : cnt);
return 0;
C. MAX-MEX Cut
if(s1[i]=='2') continue;
if(s1[i]=='0') cnt+=1;
if(s1[i]!=s2[i])
{
cnt+=2;
continue;
}
if(s1[i]=='1')
{
if(s1[i-1]=='0' && s2[i-1]=='0') cnt+=1;
else
{
if(s1[i+1]=='0'&&s2[i+1]=='0')
{
s1[i+1]='2';
cnt+=2;
}
}
}