This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int b[N], bl;
bool check(int x) {
bl = 0;
// 1、转九进制
while (x) {
int a = x % 9;
// 2、检查在九进制情况下,每个数位是不是奇数
if (a % 2 == 0) return false;
b[++bl] = a; // 将每个数位增加到b数组中
x /= 9;
}
// 3、检查在九进制情况下,是不是回文数
for (int i = 1, j = bl; i <= j; i++, j--)
if (b[i] != b[j]) return false;
return true;
int main() {
int n, m, cnt = 0;
cin >> n >> m;
for (int i = n; i <= m; i++)
if (check(i)) cnt++;
cout << cnt << endl;
return 0;