#include<iostream>#include<algorithm>#include<cstring>usingnamespace std;int T;intgetEven(int x){int cnt =0;int t = x;while(t){
t/=10;
cnt++;}int pos =-1;
t = x;int i =1;while(t){int b = t %10;if(b %2==0) pos = i;
t /=10, i++;}if(pos ==-1)return-1;elsereturn cnt - pos +1;}intmain(){
cin >> T;while(T--){int x;
cin >> x;if(x %2==0) cout <<0<<'\n';else{int pos =getEven(x);if(pos ==1) cout <<1<<'\n';elseif(pos ==-1) cout <<-1<<'\n';else cout <<2<<'\n';}}return0;}
B
#include<iostream>#include<algorithm>#include<cstring>usingnamespace std;int T;int a, b;boolcheck(int x){if(x > a || x > b)returnfalse;int sum = a + b -2*x;return sum /2>= x;}intmain(){
cin >> T;while(T--){
cin >> a >> b;int r =min((a+b)/4,min(a, b));int l =1;if(a ==0|| b ==0|| l > r) cout <<0<<'\n';else{while(l < r){int mid =(l + r +1)>>1;if(check(mid)) l = mid;else r = mid -1;}
cout << l <<'\n';}}return0;}
A#include <iostream>#include <algorithm>#include <cstring>using namespace std;int T;int getEven(int x){ int cnt = 0; int t = x; while (t) { t/= 10; cnt++; } int pos = -1; t = x; int i = 1; while (t) { int b = t %