intget(string a, int b){ int res = 0; for (auto c : a) res = res * b + c - '0'; return res; }
b为进制,a为包含进制的字符串
更改n进制的位枚举
二进制
c ^= 1; S.insert(get(a, 2)); c ^= 1;
n进制处理
for (auto& c : b) { int t = c; for (int i = 0; i < 3; i ++ ) { if (i + '0' != t) { c = i + '0'; int x = get(b, 3); if (S.count(x)) { cout << x << endl; return0; } } } c = t; }