#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0);
typedef long long LL;
//const int N=;
int main()
{
IOS
string s;
cin>>s;
int len=s.size(), ans=0;
auto t=*s.rbegin()+'0';
for(int i=0; i<len-1; i++){
if(s[i]+'0'+t&1) ;
else ans++;
}
cout<<ans;
return 0;
}
整数切割成两段,那最后一段就取决于最后一个字符。遍历前面然后加起来判断最后一位是否为偶数即可

京公网安备 11010502036488号