#include<iostream>
using namespace std;
int jud(int a) {
	int c = 1;//位数
	while (a) {
		int t = a % 10;
		if (c % 2 != 0) {//奇数位
			if (t % 2 == 0)return 0;//偶数不符合
		}
		else {//偶数位
			if (t % 2 != 0)return 0;//奇数不符合
		}
		c++;
		a /= 10;
	}
	return 1;
}
int main() {
	int count = 0;
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		if (i % 2 != 0) {
			if (jud(i))count++;
		}
	}
	cout << count << endl;
	return 0;
}

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐